mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
save
This commit is contained in:
@@ -1,49 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<script src="https://cdn.jsdelivr.net/npm/alasql@0.4"></script>
|
||||
<script>
|
||||
|
||||
var data = [ {a: 11, b: 10}, {a: 2, b: 20}, {a: 1, b: 30} ];
|
||||
|
||||
var res = alasql('SELECT * FROM ? WHERE a = 1',[data]);
|
||||
|
||||
console.log(res)
|
||||
|
||||
|
||||
var data= [
|
||||
{ a:{aa:10}, b:2 },
|
||||
{ a:{aa:10}, b:2 },
|
||||
{ a:{aa:2} , b:2 },
|
||||
{ a:{aa:3} , b:3}
|
||||
]
|
||||
|
||||
|
||||
function db(table, sql) {
|
||||
const data = indexedDB.gettable(table)
|
||||
return alasql(sql, [data]);
|
||||
}
|
||||
|
||||
|
||||
var res = alasql('SELECT a, b FROM ? WHERE b = 2',[ data ]);
|
||||
|
||||
|
||||
console.log(res)
|
||||
|
||||
|
||||
|
||||
|
||||
alasql("INSERT INTO Persons VALUES (100, 'maquiran', 'peter', 18)");
|
||||
console.log(alasql("SELECT * FROM Persons "))
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -17,12 +17,14 @@ export class InactivityGuard implements CanActivate {
|
||||
private router:Router,
|
||||
private platform: Platform,
|
||||
public permissionService: PermissionService,
|
||||
private alertController: AlertController
|
||||
) {}
|
||||
|
||||
canActivate(
|
||||
route: ActivatedRouteSnapshot,
|
||||
state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
|
||||
|
||||
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
console.log(this.permissionList);
|
||||
if(this.permissionService.userPermission(this.permissionList.Agenda.access) || this.permissionService.userPermission(this.permissionList.Gabinete.access)){
|
||||
@@ -33,7 +35,23 @@ export class InactivityGuard implements CanActivate {
|
||||
}
|
||||
else if(this.permissionService.userPermission(this.permissionList.Actions.access)){
|
||||
this.router.navigate(['/home/publications']);
|
||||
} else {
|
||||
|
||||
this.alertController.create({
|
||||
cssClass: 'my-custom-class',
|
||||
header: 'Utilizador sem acesso a aplicação',
|
||||
buttons: [{
|
||||
text: 'Ok',
|
||||
handler: () => {
|
||||
|
||||
}
|
||||
}]
|
||||
}).then( async (alertPopup) => {
|
||||
await alertPopup.present();
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
return false
|
||||
} else if(SessionStore.exist && SessionStore.user.Inactivity && !SessionStore.hasPin ) {
|
||||
return true
|
||||
@@ -41,6 +59,7 @@ export class InactivityGuard implements CanActivate {
|
||||
return true
|
||||
}//Mobile or Tablet without session
|
||||
else {
|
||||
|
||||
if(this.permissionService.userPermission(this.permissionList.Agenda.access) || this.permissionService.userPermission(this.permissionList.Gabinete.access)){
|
||||
this.router.navigate(['/home/events']);
|
||||
}
|
||||
@@ -49,6 +68,19 @@ export class InactivityGuard implements CanActivate {
|
||||
}
|
||||
else if(this.permissionService.userPermission(this.permissionList.Actions.access)){
|
||||
this.router.navigate(['/home/publications']);
|
||||
} else {
|
||||
this.alertController.create({
|
||||
cssClass: 'my-custom-class',
|
||||
header: 'Utilizador sem acesso a aplicação',
|
||||
buttons: [{
|
||||
text: 'Ok',
|
||||
handler: () => {
|
||||
|
||||
}
|
||||
}]
|
||||
}).then( async (alertPopup)=>{
|
||||
await alertPopup.present();
|
||||
})
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ export class UserSession {
|
||||
CalendarName: "Oficial" | "Pessoal";
|
||||
CalendarRoleId: string;
|
||||
Id: number;
|
||||
OwnerUserId: any
|
||||
}[]
|
||||
RoleDescription: string
|
||||
RoleID: number
|
||||
@@ -55,12 +56,13 @@ export class UserSession {
|
||||
Id: number;
|
||||
OwnerUserId: string;
|
||||
TypeShare: number;
|
||||
CalendarToken: string;
|
||||
}[]
|
||||
UserName: string
|
||||
Password: string
|
||||
RochetChatUser: string
|
||||
RochetChatUserId: string
|
||||
Profile: any;
|
||||
Profile: 'PR' | 'MDGPR' | 'Consultant' | 'Department boss' | 'Assistant' | 'Director' | 'Deputy Director' | 'Secretariat' | 'Deputy Director' | 'General secretary' ;
|
||||
LoginPreference: 'None' | 'Password' | 'Pin' | null;
|
||||
PIN: string
|
||||
Inactivity: boolean
|
||||
|
||||
@@ -93,14 +93,6 @@
|
||||
|
||||
</div>
|
||||
|
||||
<!-- <div class="drop-down">
|
||||
<ion-icon slot="icon-only" class="arrow-down" src="assets/images/icons-arrow-arrow-down.svg"></ion-icon>
|
||||
<div class="drop-down-container">
|
||||
<ul>
|
||||
<li *ngFor="let month of monthList" (click)="dropDownChangeDate(month.id)" >{{ month.name }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- Move forward one screen of the slides -->
|
||||
<div (click)="next()" class="arrow cursor-pointer resize">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " slot="icon-only" src="assets/images/icons-calendar-arrow-right.svg"></ion-icon>
|
||||
@@ -111,11 +103,11 @@
|
||||
</ion-row>
|
||||
<ion-row class="ion-align-items-center">
|
||||
|
||||
<button *ngIf="profile == 'mdgpr' && loggeduser.Profile =='MDGPR' " (click)="changeProfile()" class="d-md-none btn-no-color resize">
|
||||
<button *ngIf="profile == 'mdgpr' && eventService.calendarOwnerIds.length >= 2 " (click)="changeProfile()" class="d-md-none btn-no-color resize">
|
||||
<ion-icon class="right-icons" src="assets/images/icons-profile-calendar-md.svg"></ion-icon>
|
||||
</button>
|
||||
|
||||
<button title="Mudar de Agenda" *ngIf="profile == 'pr' && loggeduser.Profile =='MDGPR' " (click)="changeProfile()" class="btn-no-color resize">
|
||||
<button title="Mudar de Agenda" *ngIf="profile == 'pr'&& eventService.calendarOwnerIds.length >= 2 " (click)="changeProfile()" class="btn-no-color resize">
|
||||
<ion-icon class="right-icons d-md-none" src="assets/images/icons-profile-calendar-pr.svg"></ion-icon>
|
||||
</button>
|
||||
|
||||
@@ -184,9 +176,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="calendar-border">
|
||||
|
||||
</div>
|
||||
<div class="calendar-border"></div>
|
||||
|
||||
<!-- Calendar currente date -->
|
||||
<ion-row class="timeline-header pb-0 ion-justify-content-between ion-align-items-center currente-date-timelien">
|
||||
@@ -290,7 +280,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fs-timeline flex-grow-1 d-none d-md-block d-md-block text-black pr-20 width-100 height-100 overflow-y-auto" *ngIf="loggeduser.Profile == 'MDGPR'">
|
||||
<div class="fs-timeline flex-grow-1 d-none d-md-block d-md-block text-black pr-20 width-100 height-100 overflow-y-auto" *ngIf="eventService.calendarOwnerIds.length >= 2">
|
||||
<div *ngFor="let events of TimelineMDList | keyvalue;" >
|
||||
|
||||
<div class="EventListBox-container" >
|
||||
|
||||
@@ -167,7 +167,7 @@ export class AgendaPage implements OnInit {
|
||||
private alertCtrl: AlertController,
|
||||
@Inject(LOCALE_ID) private locale: string,
|
||||
private modalCtrl: ModalController,
|
||||
private eventService: EventsService,
|
||||
public eventService: EventsService,
|
||||
private router: Router,
|
||||
private sanitizer: DomSanitizer,
|
||||
authService: AuthService,
|
||||
@@ -192,16 +192,27 @@ export class AgendaPage implements OnInit {
|
||||
if (this.loggeduser.Profile == 'MDGPR') {
|
||||
this.mobileComponent.showEventList = true;
|
||||
this.profile = "mdgpr";
|
||||
} else {
|
||||
} else if (this.loggeduser.Profile == 'PR') {
|
||||
this.profile = "pr";
|
||||
} else {
|
||||
this.profile = "mdgpr";
|
||||
}
|
||||
})
|
||||
|
||||
if (this.loggeduser.Profile == 'MDGPR') {
|
||||
this.mobileComponent.showEventList = true;
|
||||
this.profile = "mdgpr";
|
||||
} else {
|
||||
} else if (this.loggeduser.Profile == 'PR') {
|
||||
this.profile = "pr";
|
||||
} else {
|
||||
if(this.eventService.calendarOwnerIds.length >= 2) {
|
||||
this.profile = "mdgpr";
|
||||
} else if (this.eventService.hasOwnCalendar) {
|
||||
this.profile = "mdgpr";
|
||||
} else if (this.eventService.hasSharedCalendar) {
|
||||
this.profile = "pr";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.calendarHeight = "356px";
|
||||
@@ -529,8 +540,7 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
}).catch((error) => {
|
||||
this.getFromDB();
|
||||
})
|
||||
.finally(() => {
|
||||
}).finally(() => {
|
||||
this.showLoader = false;
|
||||
})
|
||||
|
||||
@@ -597,6 +607,70 @@ export class AgendaPage implements OnInit {
|
||||
.finally(() => {
|
||||
this.showLoader = false;
|
||||
})
|
||||
} else if (this.loggeduser.Profile != 'PR' && this.loggeduser.Profile != 'MDGPR'){
|
||||
if(this.profile == "mdgpr") {
|
||||
|
||||
this.eventService.getAllOwnEvents(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59')).then(
|
||||
|
||||
(response: any) => {
|
||||
console.log('ALL MD EVENTS', response);
|
||||
|
||||
this.addEventToDB(response, "md");
|
||||
|
||||
// calendar
|
||||
this.CalendarStore.removeRange(startTime, endTime, 'md')
|
||||
|
||||
// loop
|
||||
this.CalendarStore.pushEvent(response, 'md');
|
||||
|
||||
console.log('CALENDAR STORE', this.CalendarStore.eventSource)
|
||||
this.listToPresent = this.CalendarStore.eventSource
|
||||
this.trasnformData(response, 'md');
|
||||
|
||||
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
|
||||
|
||||
console.log('check list to present data', this.listToPresent);
|
||||
this.myCal.update();
|
||||
this.myCal.loadEvents();
|
||||
|
||||
this.showLoader = false;
|
||||
this.showTimeline = true;
|
||||
|
||||
}).catch((error) => {
|
||||
this.getFromDB();
|
||||
}).finally(() => {
|
||||
this.showLoader = false;
|
||||
})
|
||||
|
||||
} else if (this.profile == "pr" ) {
|
||||
|
||||
this.eventService.genericGetAllSharedEvents(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59')).then((response: any) => {
|
||||
this.addEventToDB(response, "pr");
|
||||
|
||||
this.CalendarStore.removeRange(startTime, endTime, 'pr')
|
||||
// calendar
|
||||
this.CalendarStore.pushEvent(response, 'pr');
|
||||
|
||||
this.listToPresent = this.CalendarStore.eventSource
|
||||
|
||||
|
||||
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
|
||||
|
||||
console.log('check list to present data', this.listToPresent);
|
||||
this.myCal.update();
|
||||
this.myCal.loadEvents();
|
||||
|
||||
this.showLoader = false;
|
||||
this.showTimeline = true;
|
||||
|
||||
}).catch((error) => {
|
||||
this.getFromDB()
|
||||
}).finally(() => {
|
||||
this.showLoader = false;
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -604,9 +678,11 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
let counter = 0;
|
||||
|
||||
// view MDGPR calendar with MDGPR profile
|
||||
if (this.loggeduser.Profile == 'MDGPR') {
|
||||
|
||||
|
||||
alert('MDGPR')
|
||||
|
||||
this.eventService.getAllMdEvents(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59')).then((response: any) => {
|
||||
|
||||
this.addEventToDB(response, "md");
|
||||
@@ -635,8 +711,7 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
}).catch((error) => {
|
||||
this.getFromDB()
|
||||
})
|
||||
.finally(() => {
|
||||
}).finally(() => {
|
||||
counter++;
|
||||
if (counter == 2) {
|
||||
this.showLoader = false;
|
||||
@@ -673,15 +748,14 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
}).catch((error) => {
|
||||
this.getFromDB()
|
||||
})
|
||||
.finally(() => {
|
||||
}).finally(() => {
|
||||
counter++;
|
||||
if (counter == 2) {
|
||||
this.showLoader = false;
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
} else if(this.loggeduser.Profile == 'PR') {
|
||||
|
||||
// view PR calendar with PR profile
|
||||
this.eventService.getAllPrEvents(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59')).then((response: any) => {
|
||||
@@ -719,13 +793,106 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
}).catch((error) => {
|
||||
this.getFromDB()
|
||||
})
|
||||
.finally(() => {
|
||||
}).finally(() => {
|
||||
if (counter == 1 || this.loggeduser.Profile == 'PR') {
|
||||
this.showLoader = false;
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
|
||||
if(this.loggeduser.OwnerCalendars.length != 0) {
|
||||
|
||||
this.eventService.getAllOwnEvents(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59')).then((response: any) => {
|
||||
|
||||
this.addEventToDB(response, "md");
|
||||
let eventsList = response;
|
||||
|
||||
this.CalendarStore.removeRange(startTime, endTime, 'md')
|
||||
|
||||
// loop
|
||||
this.CalendarStore.pushEvent(eventsList, 'md');
|
||||
|
||||
this.listToPresent = this.CalendarStore.eventSource
|
||||
|
||||
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
|
||||
|
||||
console.log('check list to present data', this.listToPresent);
|
||||
this.myCal.update();
|
||||
this.myCal.loadEvents();
|
||||
|
||||
this.showTimelineMD = true;
|
||||
|
||||
counter++;
|
||||
if (counter == 2) {
|
||||
this.showLoader = false;
|
||||
}
|
||||
|
||||
|
||||
}).catch((error) => {
|
||||
this.getFromDB()
|
||||
}).finally(() => {
|
||||
counter++;
|
||||
if (counter == 2) {
|
||||
this.showLoader = false;
|
||||
}
|
||||
})
|
||||
} else {
|
||||
counter++;
|
||||
if (counter == 2) {
|
||||
this.showLoader = false;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(this.loggeduser.SharedCalendars)
|
||||
|
||||
if(this.loggeduser.SharedCalendars.length != 0) {
|
||||
|
||||
|
||||
this.eventService.genericGetAllSharedEvents(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59')).then((response: any) => {
|
||||
|
||||
this.addEventToDB(response, "pr");
|
||||
let eventsList = response;
|
||||
|
||||
// clear the current month only
|
||||
this.CalendarStore.removeRange(startTime, endTime, 'pr')
|
||||
|
||||
|
||||
this.CalendarStore.pushEvent(eventsList, 'pr');
|
||||
this.listToPresent = this.CalendarStore.eventSource
|
||||
|
||||
|
||||
this.TimelinePRList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
|
||||
|
||||
console.log('check list to present data', this.listToPresent);
|
||||
|
||||
this.myCal.update();
|
||||
this.myCal.loadEvents();
|
||||
|
||||
this.showTimelinePR = true;
|
||||
|
||||
counter++;
|
||||
|
||||
if (counter == 2 || this.loggeduser.Profile == 'PR') {
|
||||
this.showLoader = false;
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
this.getFromDB()
|
||||
})
|
||||
.finally(() => {
|
||||
counter++;
|
||||
if (counter == 2) {
|
||||
this.showLoader = false;
|
||||
}
|
||||
})
|
||||
} else {
|
||||
counter++;
|
||||
if (counter == 2) {
|
||||
this.showLoader = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -751,6 +918,8 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
//Deve ser removido para ficar só um method transform
|
||||
trasnformDataDB(response) {
|
||||
|
||||
if(response) {
|
||||
console.log('Transform ', response)
|
||||
response.forEach(element => {
|
||||
let event = {
|
||||
@@ -768,6 +937,8 @@ export class AgendaPage implements OnInit {
|
||||
console.log('LIST TO PRESET', this.listToPresent)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
addEventToDB(response, profile) {
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
let responseArray = [];
|
||||
|
||||
@@ -14,7 +14,6 @@ import { AttendeesPageModal } from '../../events/attendees/attendees.page';
|
||||
import { SearchPage } from '../../search/search.page';
|
||||
import { ThemePalette } from '@angular/material/core';
|
||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { EventRecurrence } from 'src/app/models/agenda/eventrecurrence.model';
|
||||
import { ThemeService } from 'src/app/services/theme.service';
|
||||
import { NgxMatDateFormats } from '@angular-material-components/datetime-picker';
|
||||
import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
|
||||
@@ -315,6 +314,8 @@ export class NewEventPage implements OnInit {
|
||||
console.log(this.loggeduser.Profile);
|
||||
|
||||
eventId = await this.eventService.postEventPr(this.postEvent, this.postEvent.CalendarName).toPromise();
|
||||
} else {
|
||||
eventId = await this.eventService.postEventGeneric(this.postEvent, this.postEvent.CalendarName).toPromise();
|
||||
}
|
||||
|
||||
const DocumentToSave: EventAttachment[] = this.documents.map((e) => {
|
||||
|
||||
@@ -36,6 +36,7 @@ import { VoiceRecorder, VoiceRecorderPlugin, RecordingData, GenericResponse, Cur
|
||||
import { Filesystem, Directory, Encoding } from '@capacitor/filesystem';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
import { MessageService } from 'src/app/services/chat/message.service';
|
||||
import { AlertController } from '@ionic/angular';
|
||||
|
||||
@Component({
|
||||
selector: 'app-group-messages',
|
||||
@@ -85,6 +86,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
durationDisplay = '';
|
||||
duration = 0;
|
||||
showAvatar = true;
|
||||
audioPermissionStatus: 'granted'| 'denied' | 'prompt' | null = null
|
||||
|
||||
constructor(
|
||||
private menu: MenuController,
|
||||
@@ -111,6 +113,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
private processesService: ProcessesService,
|
||||
private CameraService: CameraService,
|
||||
private sanitiser: DomSanitizer,
|
||||
private alertController: AlertController
|
||||
) {
|
||||
this.loggedUserChat = authService.ValidatedUserChat['data'];
|
||||
this.isGroupCreated = true;
|
||||
@@ -296,15 +299,49 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
}
|
||||
|
||||
startRecording() {
|
||||
console.log('Recording');
|
||||
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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async startRecording() {
|
||||
|
||||
await this.checkAudioPermission();
|
||||
|
||||
if(this.audioPermissionStatus == 'granted') {
|
||||
if (this.recording) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.recording = true;
|
||||
VoiceRecorder.startRecording();
|
||||
this.calculateDuration();
|
||||
} else {
|
||||
|
||||
const alertPopup = await this.alertController.create({
|
||||
cssClass: 'my-custom-class',
|
||||
header: 'Necessita de permissão para gravar áudio',
|
||||
buttons: [{
|
||||
text: 'Ok',
|
||||
handler: () => {
|
||||
|
||||
}
|
||||
}]
|
||||
});
|
||||
|
||||
await alertPopup.present();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { AfterViewChecked, AfterViewInit, ChangeDetectorRef, Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router'
|
||||
import { GestureController, Gesture, ModalController, NavParams, PopoverController, Platform } from '@ionic/angular';
|
||||
import { GestureController, Gesture, ModalController, NavParams, PopoverController, Platform, AlertController } from '@ionic/angular';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
|
||||
import { EventPerson } from 'src/app/models/eventperson.model';
|
||||
@@ -97,6 +97,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
downloadFile: any;
|
||||
downloadProgess: number;
|
||||
|
||||
audioPermissionStatus: 'granted'| 'denied' | 'prompt' | null = null
|
||||
|
||||
constructor(
|
||||
public popoverController: PopoverController,
|
||||
private modalController: ModalController,
|
||||
@@ -122,6 +124,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
private storage: Storage,
|
||||
private fileToBase64Service: FileToBase64Service,
|
||||
private sanitiser: DomSanitizer,
|
||||
private alertController: AlertController
|
||||
) {
|
||||
this.loggedUser = authService.ValidatedUserChat['data'];
|
||||
this.roomId = this.navParams.get('roomId');
|
||||
@@ -143,6 +146,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.scrollToBottomClicked()
|
||||
}, 150)
|
||||
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -220,17 +224,49 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
}
|
||||
|
||||
startRecording() {
|
||||
console.log('Recording');
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async startRecording() {
|
||||
|
||||
await this.checkAudioPermission();
|
||||
|
||||
if(this.audioPermissionStatus == 'granted') {
|
||||
if (this.recording) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.recording = true;
|
||||
VoiceRecorder.startRecording()
|
||||
.then((result: GenericResponse) => console.log(result.value))
|
||||
.catch(error => console.log(error));
|
||||
VoiceRecorder.startRecording();
|
||||
this.calculateDuration();
|
||||
} else {
|
||||
|
||||
const alertPopup = await this.alertController.create({
|
||||
cssClass: 'my-custom-class',
|
||||
header: 'Necessita de permissão para gravar áudio',
|
||||
buttons: [{
|
||||
text: 'Ok',
|
||||
handler: () => {
|
||||
|
||||
}
|
||||
}]
|
||||
});
|
||||
|
||||
await alertPopup.present();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
stopRecording() {
|
||||
@@ -397,8 +433,10 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.storage.get('recordData').then((recordData) => {
|
||||
|
||||
audioFile = recordData;
|
||||
if(recordData?.value?.recordDataBase64.includes('data:audio')){
|
||||
this.audioRecorded = recordData?.value?.recordDataBase64;
|
||||
|
||||
if(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}`;
|
||||
@@ -426,6 +464,11 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
}],
|
||||
temporaryData: formData
|
||||
})
|
||||
} else {
|
||||
alert('no audio')
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
this.deleteRecording();
|
||||
|
||||
@@ -194,16 +194,22 @@ export class InactivityPage implements OnInit {
|
||||
if(pathName) {
|
||||
this.router.navigate([pathName],{replaceUrl: true});
|
||||
} else {
|
||||
|
||||
setTimeout(()=>{
|
||||
this.router.navigate(['/home/events'], {replaceUrl: true});
|
||||
}, 5000)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
storePin() {
|
||||
|
||||
setTimeout(()=>{
|
||||
const code = this.code.join('');
|
||||
SessionStore.setPin(code);
|
||||
this.router.navigate(['/home/events']);
|
||||
}, 5000)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -123,11 +123,12 @@ export class LoginPage implements OnInit {
|
||||
await this.authService.SetSession(attempt, this.userattempt);
|
||||
|
||||
this.changeProfileService.run();
|
||||
|
||||
await this.authService.loginChat();
|
||||
await this.authService.loginToChatWs();
|
||||
this.getToken();
|
||||
this.router.navigateByUrl('/pin', { replaceUrl: true });
|
||||
|
||||
this.router.navigateByUrl('/pin', { replaceUrl: true });
|
||||
}
|
||||
}
|
||||
else{
|
||||
@@ -155,7 +156,6 @@ export class LoginPage implements OnInit {
|
||||
this.router.navigate(['/home/chat']);
|
||||
}
|
||||
else if(this.permissionService.userPermission(this.permissionList.Actions.access)){
|
||||
alert('here')
|
||||
this.router.navigate(['/home/publications']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,9 +97,26 @@ export class AuthService {
|
||||
session.Profile = 'PR'
|
||||
} else if(session.RoleID == 100000011) {
|
||||
session.Profile = 'MDGPR'
|
||||
} else if(session.RoleID == 99999872) {
|
||||
session.Profile = 'Consultant'
|
||||
}
|
||||
else{
|
||||
session.Profile = this.initialsService.getInitials(session.FullName);
|
||||
else if(session.RoleID == 99999873) {
|
||||
session.Profile = 'Assistant'
|
||||
}
|
||||
else if(session.RoleID == 99999874) {
|
||||
session.Profile = 'Department boss'
|
||||
}
|
||||
else if(session.RoleID == 99999875) {
|
||||
session.Profile = 'Director'
|
||||
}
|
||||
else if(session.RoleID == 99999876) {
|
||||
session.Profile = 'Deputy Director'
|
||||
}
|
||||
else if(session.RoleID == 99999885) {
|
||||
session.Profile = 'Secretariat'
|
||||
}
|
||||
else if(session.RoleID == 99999886) {
|
||||
session.Profile = 'General secretary'
|
||||
}
|
||||
|
||||
session.Password = user.password
|
||||
@@ -131,7 +148,7 @@ export class AuthService {
|
||||
let responseChat = await this.httpService.post('login', postData).toPromise();
|
||||
|
||||
if(responseChat) {
|
||||
console.log('Login to Rocket chat OK', responseChat);
|
||||
|
||||
this.ValidatedUserChat = responseChat;
|
||||
localStorage.setItem('userChat', JSON.stringify(responseChat));
|
||||
this.storageService.store(AuthConnstants.AUTH, responseChat);
|
||||
@@ -211,7 +228,7 @@ export class AuthService {
|
||||
|
||||
this.NfService.downloadFileMsg = async (message: MessageService, room?: RoomService) => {
|
||||
|
||||
console.log('FILE TYPE', message.file.type)
|
||||
// console.log('FILE TYPE', message.file.type)
|
||||
let downloadFile = "";
|
||||
if (message.file.type == "application/img") {
|
||||
const event: any = await this.AttachmentsService.downloadFile(message.file.guid).toPromise();
|
||||
@@ -220,7 +237,7 @@ export class AuthService {
|
||||
|
||||
if (event.type === HttpEventType.DownloadProgress) {
|
||||
//this.downloadProgess = Math.round((100 * event.loaded) / event.total);
|
||||
console.log('FILE TYPE 33', message.file.type)
|
||||
// console.log('FILE TYPE 33', message.file.type)
|
||||
return true
|
||||
} else if (event.type === HttpEventType.Response) {
|
||||
downloadFile = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
|
||||
@@ -232,7 +249,7 @@ export class AuthService {
|
||||
}
|
||||
|
||||
await this.storage.set(message.file.guid, downloadFile).then(() => {
|
||||
console.log('IMAGE SAVED')
|
||||
// console.log('IMAGE SAVED')
|
||||
});
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -28,9 +28,21 @@ export class EventsService {
|
||||
headersMdOficial: HttpHeaders;
|
||||
headersMdPessoal: HttpHeaders;
|
||||
|
||||
headerOwnOficial: HttpHeaders;
|
||||
headersOwnPessoal: HttpHeaders;
|
||||
|
||||
headerSharedOficial: HttpHeaders;
|
||||
headerSharedPessoal: HttpHeaders;
|
||||
|
||||
headersSharedOficial: HttpHeaders;
|
||||
headersSharedPessoal: HttpHeaders;
|
||||
|
||||
hasSharedCalendar = false
|
||||
hasOwnCalendar = false
|
||||
|
||||
|
||||
calendarOwnerIds = []
|
||||
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
public user: AuthService,
|
||||
@@ -51,6 +63,13 @@ export class EventsService {
|
||||
this.headersSharedPessoal = new HttpHeaders();
|
||||
|
||||
|
||||
this.headerOwnOficial= new HttpHeaders();
|
||||
this.headersOwnPessoal= new HttpHeaders();
|
||||
|
||||
this.headerSharedOficial= new HttpHeaders();
|
||||
this.headerSharedPessoal= new HttpHeaders();
|
||||
|
||||
|
||||
this.setHeader()
|
||||
this.changeProfileService.registerCallback(() => {
|
||||
this.loggeduser = this.user.ValidatedUser;
|
||||
@@ -61,10 +80,23 @@ export class EventsService {
|
||||
|
||||
setHeader() {
|
||||
|
||||
this.hasSharedCalendar = false
|
||||
this.hasOwnCalendar = false
|
||||
|
||||
|
||||
this.calendarOwnerIds = []
|
||||
|
||||
if (this.loggeduser) {
|
||||
if (this.loggeduser.Profile == 'MDGPR') {
|
||||
|
||||
this.loggeduser.OwnerCalendars.forEach(calendar => {
|
||||
|
||||
if(!this.calendarOwnerIds.includes(calendar.OwnerUserId)) {
|
||||
this.calendarOwnerIds.push(calendar.OwnerUserId)
|
||||
}
|
||||
|
||||
this.hasOwnCalendar = true
|
||||
|
||||
if (calendar.CalendarName == 'Oficial') {
|
||||
this.headersMdOficial = this.headersMdOficial.set('Authorization', this.loggeduser.BasicAuthKey);
|
||||
this.headersMdOficial = this.headersMdOficial.set('CalendarId', calendar.CalendarId);
|
||||
@@ -79,6 +111,13 @@ export class EventsService {
|
||||
});
|
||||
|
||||
this.loggeduser.SharedCalendars.forEach(sharedCalendar => {
|
||||
|
||||
if(!this.calendarOwnerIds.includes(sharedCalendar.OwnerUserId)) {
|
||||
this.calendarOwnerIds.push(sharedCalendar.OwnerUserId)
|
||||
}
|
||||
|
||||
this.hasSharedCalendar = true
|
||||
|
||||
if (sharedCalendar.CalendarName == 'Oficial') {
|
||||
this.headersSharedOficial = this.headersSharedOficial.set('Authorization', this.loggeduser.BasicAuthKey);
|
||||
this.headersSharedOficial = this.headersSharedOficial.set('CalendarId', sharedCalendar.CalendarId);
|
||||
@@ -94,6 +133,13 @@ export class EventsService {
|
||||
else if (this.loggeduser.Profile == 'PR') {
|
||||
|
||||
this.loggeduser.OwnerCalendars.forEach(calendar => {
|
||||
|
||||
if(!this.calendarOwnerIds.includes(calendar.OwnerUserId)) {
|
||||
this.calendarOwnerIds.push(calendar.OwnerUserId)
|
||||
}
|
||||
|
||||
this.hasOwnCalendar = true
|
||||
|
||||
if (calendar.CalendarName == 'Oficial') {
|
||||
this.headersPrOficial = this.headersPrOficial.set('Authorization', this.loggeduser.BasicAuthKey);
|
||||
this.headersPrOficial = this.headersPrOficial.set('CalendarId', calendar.CalendarId);
|
||||
@@ -106,6 +152,52 @@ export class EventsService {
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
|
||||
this.loggeduser.OwnerCalendars.forEach(calendar => {
|
||||
|
||||
if(!this.calendarOwnerIds.includes(calendar.OwnerUserId)) {
|
||||
this.calendarOwnerIds.push(calendar.OwnerUserId)
|
||||
}
|
||||
this.hasOwnCalendar = true
|
||||
|
||||
if (calendar.CalendarName == 'Oficial') {
|
||||
this.headerOwnOficial = this.headerOwnOficial.set('Authorization', this.loggeduser.BasicAuthKey);
|
||||
this.headerOwnOficial = this.headerOwnOficial.set('CalendarId', calendar.CalendarId);
|
||||
this.headerOwnOficial = this.headerOwnOficial.set('CalendarRoleId', calendar.CalendarRoleId);
|
||||
}
|
||||
else if (calendar.CalendarName == 'Pessoal') {
|
||||
this.headersOwnPessoal.set('Authorization', this.loggeduser.BasicAuthKey);
|
||||
this.headersOwnPessoal.set('CalendarId', calendar.CalendarId);
|
||||
this.headersOwnPessoal.set('CalendarRoleId', calendar.CalendarRoleId);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
for (let sharedCalendar of this.loggeduser.SharedCalendars) {
|
||||
|
||||
|
||||
if(!this.calendarOwnerIds.includes(sharedCalendar.OwnerUserId)) {
|
||||
this.calendarOwnerIds.push(sharedCalendar.OwnerUserId)
|
||||
}
|
||||
|
||||
this.hasSharedCalendar = true
|
||||
|
||||
if (sharedCalendar.CalendarName == 'Oficial') {
|
||||
this.headerSharedOficial = this.headerSharedOficial.set('Authorization', 'Basic '+sharedCalendar.CalendarToken);
|
||||
this.headerSharedOficial = this.headerSharedOficial.set('CalendarId', sharedCalendar.CalendarId);
|
||||
this.headerSharedOficial = this.headerSharedOficial.set('CalendarRoleId', sharedCalendar.CalendarRoleId);
|
||||
}
|
||||
else if (sharedCalendar.CalendarName == 'Pessoal') {
|
||||
this.headerSharedPessoal = this.headerSharedPessoal.set('Authorization', 'Basic '+sharedCalendar.CalendarToken);
|
||||
this.headerSharedPessoal = this.headerSharedPessoal.set('CalendarId', sharedCalendar.CalendarId);
|
||||
this.headerSharedPessoal = this.headerSharedPessoal.set('CalendarRoleId', sharedCalendar.CalendarRoleId);
|
||||
}
|
||||
}
|
||||
|
||||
console.log(this.loggeduser.SharedCalendars)
|
||||
|
||||
}
|
||||
|
||||
this.headers = new HttpHeaders();
|
||||
@@ -113,20 +205,6 @@ export class EventsService {
|
||||
}
|
||||
}
|
||||
|
||||
/* getAllEvents(startdate:string, enddate:string): Observable<Event[]>{
|
||||
const geturl = environment.apiURL + 'calendar/GetAllEvents';
|
||||
let params = new HttpParams();
|
||||
|
||||
params = params.set("StartDate", startdate);
|
||||
params = params.set("EndDate", enddate);
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
};
|
||||
return this.http.get<Event[]>(`${geturl}`, options);
|
||||
} */
|
||||
|
||||
|
||||
getAllPrOficialEvents(startdate: string, enddate: string): Observable<EventList[]> {
|
||||
let geturl = environment.apiURL + 'calendar/pr';
|
||||
@@ -208,6 +286,93 @@ export class EventsService {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async getAllOwnEvents(startdate: string, enddate: string) {
|
||||
let ownO = await this.getAllOwnOficialEvents(startdate, enddate).toPromise();
|
||||
let ownP = await this.getAllOwnPessoalEvents(startdate, enddate).toPromise();
|
||||
const resFinal = ownO.concat(ownP);
|
||||
return new Promise(resolve => {
|
||||
return resolve(resFinal)
|
||||
});
|
||||
}
|
||||
|
||||
getAllOwnOficialEvents(startdate: string, enddate: string): Observable<EventList[]> {
|
||||
let geturl = environment.apiURL + 'calendar/GetEvents';
|
||||
|
||||
let params = new HttpParams();
|
||||
|
||||
params = params.set("StartDate", startdate);
|
||||
params = params.set("EndDate", enddate);
|
||||
|
||||
|
||||
let options = {
|
||||
headers: this.headerOwnOficial,
|
||||
params: params
|
||||
};
|
||||
return this.http.get<EventList[]>(`${geturl}`, options);
|
||||
}
|
||||
|
||||
getAllOwnPessoalEvents(startdate: string, enddate: string): any {
|
||||
let geturl = environment.apiURL + 'calendar/GetEvents';
|
||||
|
||||
let params = new HttpParams();
|
||||
|
||||
params = params.set("StartDate", startdate);
|
||||
params = params.set("EndDate", enddate);
|
||||
|
||||
let options = {
|
||||
headers: this.headersOwnPessoal,
|
||||
params: params
|
||||
};
|
||||
return this.http.get<any>(`${geturl}`, options)
|
||||
}
|
||||
|
||||
async genericGetAllSharedEvents(startdate: string, enddate: string) {
|
||||
|
||||
let prO = await this.genericGetAllSharedOficialEvents(startdate, enddate).toPromise();
|
||||
let prP = await this.genericGetAllSharedPessoalEvents(startdate, enddate).toPromise();
|
||||
const resFinal = prO.concat(prP);
|
||||
|
||||
return new Promise(resolve => {
|
||||
return resolve(resFinal)
|
||||
});
|
||||
}
|
||||
|
||||
genericGetAllSharedOficialEvents(startdate: string, enddate: string): Observable<Event[]> {
|
||||
let geturl = environment.apiURL + 'calendar/GetEvents';
|
||||
geturl = geturl.replace('/V4/', '/V5/')
|
||||
|
||||
let params = new HttpParams();
|
||||
|
||||
params = params.set("StartDate", startdate);
|
||||
params = params.set("EndDate", enddate);
|
||||
|
||||
|
||||
|
||||
let options = {
|
||||
headers: this.headerSharedOficial,
|
||||
params: params
|
||||
};
|
||||
|
||||
return this.http.get<Event[]>(`${geturl}`, options);
|
||||
}
|
||||
|
||||
genericGetAllSharedPessoalEvents(startdate: string, enddate: string): Observable<Event[]> {
|
||||
let geturl = environment.apiURL + 'calendar/GetEvents';
|
||||
geturl = geturl.replace('/V4/', '/V5/')
|
||||
|
||||
let params = new HttpParams();
|
||||
|
||||
params = params.set("StartDate", startdate);
|
||||
params = params.set("EndDate", enddate);
|
||||
|
||||
let options = {
|
||||
headers: this.headerSharedPessoal,
|
||||
params: params
|
||||
};
|
||||
return this.http.get<Event[]>(`${geturl}`, options);
|
||||
}
|
||||
|
||||
async getAllSharedEvents(startdate: string, enddate: string) {
|
||||
let prO = await this.getAllSharedOficialEvents(startdate, enddate).toPromise();
|
||||
let prP = await this.getAllSharedPessoalEvents(startdate, enddate).toPromise();
|
||||
@@ -328,6 +493,8 @@ export class EventsService {
|
||||
}
|
||||
else if (this.loggeduser.Profile == 'PR') {
|
||||
this.headers = this.headersPrOficial;
|
||||
} else {
|
||||
this.headers = this.headerOwnOficial
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -337,6 +504,9 @@ export class EventsService {
|
||||
else if (this.loggeduser.Profile == 'PR') {
|
||||
this.headers = this.headersPrPessoal;
|
||||
}
|
||||
else {
|
||||
this.headers = this.headersOwnPessoal
|
||||
}
|
||||
}
|
||||
|
||||
let options = {
|
||||
@@ -361,21 +531,6 @@ export class EventsService {
|
||||
return this.http.post<any>(`${puturl}`, body, options);
|
||||
}
|
||||
|
||||
/* postEvent(event:Event, calendarName:string, sharedagenda:string)
|
||||
{
|
||||
const puturl = environment.apiURL + 'calendar/' + ((sharedagenda != '') ? sharedagenda : 'PostEvent');
|
||||
let params = new HttpParams();
|
||||
|
||||
params = params.set("CalendarName", calendarName);
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
};
|
||||
|
||||
return this.http.post<Event>(`${puturl}`, event, options)
|
||||
} */
|
||||
|
||||
postEventMd(event: Event, calendarName: string) {
|
||||
const puturl = environment.apiURL + 'calendar/md';
|
||||
let params = new HttpParams();
|
||||
@@ -432,6 +587,36 @@ export class EventsService {
|
||||
return this.http.post<string>(`${puturl}`, event, options)
|
||||
}
|
||||
|
||||
|
||||
|
||||
postEventGeneric(event: Event, calendarName: string) {
|
||||
const puturl = environment.apiURL + 'Calendar/PostEvent';
|
||||
let params = new HttpParams();
|
||||
|
||||
params = params.set("CalendarName", calendarName);
|
||||
|
||||
let options: any;
|
||||
|
||||
switch (calendarName) {
|
||||
case 'Oficial':
|
||||
options = {
|
||||
headers: this.headerSharedOficial,
|
||||
params: params
|
||||
};
|
||||
break;
|
||||
|
||||
case 'Pessoal':
|
||||
|
||||
options = {
|
||||
headers: this.headerSharedPessoal,
|
||||
params: params
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
||||
return this.http.post<string>(`${puturl}`, event, options)
|
||||
}
|
||||
|
||||
deleteEvent(eventid: string, eventDeleteType: number, calendarName: string) {
|
||||
let arrayReq = [];
|
||||
let Object = {
|
||||
|
||||
@@ -25,7 +25,7 @@ export class PermissionService {
|
||||
}
|
||||
|
||||
|
||||
for(let permission of (this.SessionStore.user.UserPermissions || [])) {
|
||||
for(let permission of ([...(this.SessionStore.user.UserPermissions || [] ), 530] || [])) {
|
||||
if (args.includes(permission)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -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')
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ 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, Platform, NavParams } from '@ionic/angular';
|
||||
|
||||
/*
|
||||
import * as pdfjsLib from 'pdfjs-dist';
|
||||
@@ -99,6 +100,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,
|
||||
@@ -121,6 +124,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
private CameraService: CameraService,
|
||||
private toastService: ToastService,
|
||||
private sanitiser: DomSanitizer,
|
||||
private alertController: AlertController
|
||||
|
||||
) {
|
||||
console.log('OnCONSTRUCTOR');
|
||||
@@ -293,15 +297,49 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
|
||||
}
|
||||
|
||||
startRecording() {
|
||||
console.log('Recording');
|
||||
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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async startRecording() {
|
||||
|
||||
await this.checkAudioPermission();
|
||||
|
||||
if(this.audioPermissionStatus == 'granted') {
|
||||
if (this.recording) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.recording = true;
|
||||
VoiceRecorder.startRecording();
|
||||
this.calculateDuration();
|
||||
} else {
|
||||
|
||||
const alertPopup = await this.alertController.create({
|
||||
cssClass: 'my-custom-class',
|
||||
header: 'Necessita de permissão para gravar áudio',
|
||||
buttons: [{
|
||||
text: 'Ok',
|
||||
handler: () => {
|
||||
|
||||
}
|
||||
}]
|
||||
});
|
||||
|
||||
await alertPopup.present();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
stopRecording() {
|
||||
|
||||
@@ -232,6 +232,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>
|
||||
|
||||
@@ -35,6 +35,7 @@ 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';
|
||||
|
||||
const IMAGE_DIR = 'stored-images';
|
||||
@Component({
|
||||
@@ -90,6 +91,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,
|
||||
@@ -118,8 +121,11 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
private processesService: ProcessesService,
|
||||
private fileToBase64Service: FileToBase64Service,
|
||||
private sanitiser: DomSanitizer,
|
||||
private alertController: AlertController
|
||||
) {
|
||||
this.loggedUser = authService.ValidatedUserChat['data'];
|
||||
|
||||
this.checkAudioPermission()
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
@@ -144,6 +150,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();
|
||||
|
||||
@@ -268,14 +288,36 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
|
||||
}
|
||||
|
||||
startRecording() {
|
||||
async startRecording() {
|
||||
|
||||
|
||||
await this.checkAudioPermission();
|
||||
|
||||
if(this.audioPermissionStatus == 'granted') {
|
||||
if (this.recording) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.recording = true;
|
||||
VoiceRecorder.startRecording();
|
||||
this.calculateDuration();
|
||||
} else {
|
||||
|
||||
const alertPopup = await this.alertController.create({
|
||||
cssClass: 'my-custom-class',
|
||||
header: 'Necessita de permissão para gravar áudio',
|
||||
buttons: [{
|
||||
text: 'Ok',
|
||||
handler: () => {
|
||||
|
||||
}
|
||||
}]
|
||||
});
|
||||
|
||||
await alertPopup.present();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
stopRecording() {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<svg width="45" height="45" viewBox="0 0 45 45" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M22.5 45C34.9264 45 45 34.9264 45 22.5C45 10.0736 34.9264 0 22.5 0C10.0736 0 0 10.0736 0 22.5C0 34.9264 10.0736 45 22.5 45Z" fill="#CDCCCA"/>
|
||||
<path d="M27.7273 12.7273C27.7273 9.56419 25.1631 7 22 7C18.8369 7 16.2727 9.56419 16.2727 12.7273V20.9091C16.2727 24.0722 18.8369 26.6364 22 26.6364C25.1631 26.6364 27.7273 24.0722 27.7273 20.9091V12.7273Z" stroke="white" stroke-width="2"/>
|
||||
<path d="M26.0909 11.9091H24.4545C23.5508 11.9091 22.8182 12.6417 22.8182 13.5455C22.8182 14.4492 23.5508 15.1818 24.4545 15.1818H26.0909C26.9946 15.1818 27.7273 14.4492 27.7273 13.5455C27.7273 12.6417 26.9946 11.9091 26.0909 11.9091Z" fill="white"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M21.1818 29.9091H22.8182V36.4545H21.1818V29.9091Z" fill="white"/>
|
||||
<path d="M26.9091 36.4546H17.0909C16.639 36.4546 16.2727 36.8209 16.2727 37.2727C16.2727 37.7246 16.639 38.0909 17.0909 38.0909H26.9091C27.3609 38.0909 27.7273 37.7246 27.7273 37.2727C27.7273 36.8209 27.3609 36.4546 26.9091 36.4546Z" fill="white"/>
|
||||
<path d="M31 19.2727C31 25.3731 28.7778 29.9091 22 29.9091C15.2222 29.9091 13 25.3731 13 19.2727" stroke="white" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -2,15 +2,31 @@
|
||||
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
|
||||
// The list of file replacements can be found in `angular.json`.
|
||||
|
||||
|
||||
// const DEV = {
|
||||
// apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/',
|
||||
// apiChatUrl: 'https://www.tabularium.pt/api/v1/',
|
||||
// apiWsChatUrl: 'wss://www.tabularium.pt/websocket',
|
||||
// defaultuser: 'paulo.pinto@gabinetedigital.local',//paulo.pinto paulo.pinto@gabinetedigital.local
|
||||
// defaultuserpwd: 'tabteste@006', //tabteste@006,
|
||||
// }
|
||||
|
||||
// const QEI = {
|
||||
// apiChatUrl: 'https://gabinetedigitalchat.dyndns.info/api/v1/',
|
||||
// apiWsChatUrl: 'wss://gabinetedigitalchat.dyndns.info/websocket',
|
||||
// apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/',
|
||||
// defaultuser: 'paulo.pinto@gabinetedigital.local',//paulo.pinto paulo.pinto@gabinetedigital.local
|
||||
// defaultuserpwd: 'tabteste@006', //tabteste@006,
|
||||
// }
|
||||
|
||||
export const environment = {
|
||||
production: false,
|
||||
//apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/',
|
||||
apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/',
|
||||
/* apiChatUrl: 'https://gabinetedigitalchat.dyndns.info/api/v1/',
|
||||
apiWsChatUrl: 'wss://gabinetedigitalchat.dyndns.info/websocket', */
|
||||
apiChatUrl: 'https://www.tabularium.pt/api/v1/',
|
||||
apiWsChatUrl: 'wss://www.tabularium.pt/websocket',
|
||||
/* apiChatUrl: 'http://chat.gabinetedigital.local:3000/api/v1/', */
|
||||
apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/',
|
||||
//apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/',
|
||||
apiChatUrl: 'https://gabinetedigitalchat.dyndns.info/api/v1/',
|
||||
apiWsChatUrl: 'wss://gabinetedigitalchat.dyndns.info/websocket',
|
||||
//apiChatUrl: 'https://www.tabularium.pt/api/v1/',
|
||||
//apiWsChatUrl: 'wss://www.tabularium.pt/websocket',
|
||||
domain: 'gabinetedigital.local', //gabinetedigital.local
|
||||
defaultuser: 'paulo.pinto@gabinetedigital.local',//paulo.pinto paulo.pinto@gabinetedigital.local
|
||||
defaultuserpwd: 'tabteste@006', //tabteste@006,
|
||||
|
||||
Reference in New Issue
Block a user