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
+33 -1
View File
@@ -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
}
+2 -2
View File
@@ -1,6 +1,6 @@
<ion-tabs class="tab">
<ion-tab-bar class="bottoms" slot="bottom">
<ion-tabs class="tab" >
<ion-tab-bar *ngIf="p.userPermissionCount([permissionList.Agenda.access, permissionList.Gabinete.access, permissionList.Actions.access, permissionList.Chat.access]) >= 2" class="bottoms" slot="bottom">
<ion-tab-button *ngIf="p.userPermission([permissionList.Agenda.access]) || p.userPermission([permissionList.Gabinete.access])" tab="events" [class.active]="pathname === '/home/events'">
<!-- <ion-icon name="home"></ion-icon> -->
+1
View File
@@ -7,6 +7,7 @@ export interface EventListStore {
calendarName: "Oficial" |"Pessoal"
profile: "md" | "pr",
id: string
CalendarId: any
}
export interface EventList {
+4 -1
View File
@@ -40,11 +40,13 @@ export class UserSession {
Authorization: string;
Email: string
FullName: string
ManagerName: string
OwnerCalendars: {
CalendarId: string
CalendarName: "Oficial" | "Pessoal";
CalendarRoleId: string;
Id: number;
OwnerUserId: any
}[]
RoleDescription: string
RoleID: number
@@ -55,12 +57,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
+20 -16
View File
@@ -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>
@@ -110,12 +102,25 @@
</ion-row>
<ion-row class="ion-align-items-center">
<!-- <div *ngIf="loggeduser.Profile != 'PR' && loggeduser.Profile != 'MDGPR'" class="calendar-letters"> -->
<div class="calendar-letters cal-reverse" *ngIf="loggeduser.Profile != 'PR' && loggeduser.Profile != 'MDGPR' && eventService.calendarOwnerIds.length >= 2" class="calendar-letters" [class.cal-reverse]="loggeduser.Profile != 'PR' && loggeduser.Profile != 'MDGPR' && profile == 'mdgpr' " (click)="changeProfile()">
<div class="text" *ngIf="profile == 'mdgpr'">
{{ sessionStore.getInitials }}
</div>
<button *ngIf="profile == 'mdgpr' && loggeduser.Profile =='MDGPR' " (click)="changeProfile()" class="d-md-none btn-no-color resize">
<div class="text" *ngIf="profile == 'pr'">
{{ sessionStore.getManagerInitials }}
</div>
</div>
<button *ngIf="profile == 'mdgpr' && eventService.calendarOwnerIds.length >= 2 && ( loggeduser.Profile == 'PR' || loggeduser.Profile == 'MDGPR') " (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 && ( loggeduser.Profile == 'PR' || loggeduser.Profile == 'MDGPR')" (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 +189,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">
@@ -228,11 +231,11 @@
<div class="calendar-title-container px-20 d-none d-md-flex" *ngIf="loggeduser.Profile == 'MDGPR'">
<div class="calendar-title-description flex-grow-1 text-grey d-flex justify-center align-center">
<div>Calendário do MDGPR</div>
<div *ngIf="loggeduser.Profile == 'PR' || loggeduser.Profile == 'MDGPR'">Calendário do MDGPR</div>
</div>
<div class="calendar-title-description text-black align-center">
<div class="flex-grow-1 text-grey d-flex justify-center align-center">
<div>Calendário do Presidente da República</div>
<div *ngIf="loggeduser.Profile == 'PR' || loggeduser.Profile == 'MDGPR'">Calendário do Presidente da República</div>
</div>
</div>
</div>
@@ -248,6 +251,7 @@
<div class="timeline-container height-100 d-flex pt-20 pl-20 pl-20 filter-{{segment}}" >
<div class="ss-timeline timeline-mobile flex-grow-1 d-md-none text-black height-100 width-100 overflow-y-auto" >
<div *ngFor="let events of TimelineMDList | keyvalue;" >
<div class="EventListBox-container" >
@@ -290,7 +294,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" >
+23
View File
@@ -857,3 +857,26 @@ $font-size: 11pt;
}
}
.calendar-letters {
width: 36px;
height: 36px;
background-color: #f05d5e;
border-radius: 44px;
text-align: center;
align-items: center;
display: flex;
justify-content: center;
margin-top: -3px;
border: 1.5px solid black;
color: white;
.text{
}
}
.cal-reverse {
background: white !important;
color: black !important;
border-color: #f05d5e !important;
}
+251 -41
View File
@@ -32,6 +32,7 @@ import { ChangeProfileService } from 'src/app/services/change-profile.service';
import { SqliteService } from 'src/app/services/sqlite.service';
import { BackgroundService } from 'src/app/services/background.service';
import { ThemeService } from 'src/app/services/theme.service'
import { SessionStore } from 'src/app/store/session.service';
@Component({
@@ -163,11 +164,13 @@ export class AgendaPage implements OnInit {
listToPresent
array = []
sessionStore = SessionStore;
constructor(
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 +195,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";
@@ -285,6 +299,7 @@ export class AgendaPage implements OnInit {
/* console.log('Event clicked', event); */
//clear
console.log(event)
this.setIntervenient([]);
this.setIntervenientCC([]);
@@ -529,8 +544,7 @@ export class AgendaPage implements OnInit {
}).catch((error) => {
this.getFromDB();
})
.finally(() => {
}).finally(() => {
this.showLoader = false;
})
@@ -560,9 +574,9 @@ export class AgendaPage implements OnInit {
}).catch((error) => {
this.getFromDB()
})
.finally(() => {
this.showLoader = false;
})
.finally(() => {
this.showLoader = false;
})
}
else if (this.loggeduser.Profile == 'PR') {
@@ -597,6 +611,69 @@ 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,7 +681,6 @@ export class AgendaPage implements OnInit {
let counter = 0;
// view MDGPR calendar with MDGPR profile
if (this.loggeduser.Profile == '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) => {
@@ -635,13 +711,12 @@ export class AgendaPage implements OnInit {
}).catch((error) => {
this.getFromDB()
}).finally(() => {
counter++;
if (counter == 2) {
this.showLoader = false;
}
})
.finally(() => {
counter++;
if (counter == 2) {
this.showLoader = false;
}
})
this.eventService.getAllSharedEvents(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59')).then((response: any) => {
@@ -673,15 +748,14 @@ export class AgendaPage implements OnInit {
}).catch((error) => {
this.getFromDB()
})
.finally(() => {
}).finally(() => {
counter++;
if (counter == 2) {
this.showLoader = false;
}
})
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,12 +793,104 @@ export class AgendaPage implements OnInit {
}).catch((error) => {
this.getFromDB()
}).finally(() => {
if (counter == 1 || this.loggeduser.Profile == 'PR') {
this.showLoader = false;
}
})
.finally(() => {
if (counter == 1 || this.loggeduser.Profile == 'PR') {
} 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 })
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,21 +917,25 @@ export class AgendaPage implements OnInit {
//Deve ser removido para ficar só um method transform
trasnformDataDB(response) {
console.log('Transform ', response)
response.forEach(element => {
let event = {
startTime: new Date(element.StartDate),
endTime: new Date(element.EndDate),
allDay: false,
event: element,
calendarName: element.CalendarName,
profile: element.Profile,
id: element.EventId,
}
this.array.push(event)
});
this.listToPresent = this.array;
console.log('LIST TO PRESET', this.listToPresent)
if(response) {
console.log('Transform ', response)
response.forEach(element => {
let event = {
startTime: new Date(element.StartDate),
endTime: new Date(element.EndDate),
allDay: false,
event: element,
calendarName: element.CalendarName,
profile: element.Profile,
id: element.EventId,
}
this.array.push(event)
});
this.listToPresent = this.array;
console.log('LIST TO PRESET', this.listToPresent)
}
}
addEventToDB(response, profile) {
@@ -848,6 +1018,25 @@ export class AgendaPage implements OnInit {
}
getEventsFromDB () {
new Promise((resolve, reject)=>{
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storage.get('agendaResponse').then((events) => {
resolve(events)
})
} else {
this.sqliteservice.getAllEvents().then((events: any[]) => {
resolve(events)
})
}
})
}
updateEventListBox() {
if (window.innerWidth < 800) {
@@ -866,6 +1055,14 @@ export class AgendaPage implements OnInit {
}
else if (this.loggeduser.Profile == 'PR') {
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
} else {
if(this.profile == "pr") {
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
} else if (this.profile == "mdgpr") {
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
}
}
break;
@@ -875,9 +1072,15 @@ export class AgendaPage implements OnInit {
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
}
else {
else if(this.loggeduser.Profile == 'PR') {
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
this.TimelinePRList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
} else {
if(this.profile == "pr") {
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
} else if (this.profile == "mdgpr") {
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
}
}
break;
@@ -886,15 +1089,22 @@ export class AgendaPage implements OnInit {
if (this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR') {
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, {segment: this.segment, selectedDate: this.eventSelectedDate})
} else {
} else if(this.loggeduser.Profile == 'PR') {
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
this.TimelinePRList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
} else {
if(this.profile == "pr") {
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
} else if (this.profile == "mdgpr") {
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
}
}
break;
}
} else {
this.TimelinePRList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
@@ -14,6 +14,8 @@ import { SearchPage } from '../../search/search.page';
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';
import { SessionStore } from 'src/app/store/session.service';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: {
@@ -79,6 +81,8 @@ export class EditEventPage implements OnInit {
public stepMinutes = [1, 5, 10, 15, 20, 25];
public stepSeconds = [1, 5, 10, 15, 20, 25];
sesseionStora = SessionStore
constructor(
private modalController: ModalController,
private navParams: NavParams,
@@ -249,29 +253,57 @@ export class EditEventPage implements OnInit {
this.postEvent.EventRecurrence.Type = this.selectedRecurringType;
this.eventsService.editEvent(this.postEvent, 2, 3).subscribe(async () => {
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
this.eventsService.editEvent(this.postEvent, 2, 3).subscribe(async () => {
if(this.initCalendarName != this.postEvent.CalendarName) {
let body = {
"EventId": this.postEvent.EventId,
"CalendarDestinationName": this.postEvent.CalendarName,
if(this.initCalendarName != this.postEvent.CalendarName) {
let body = {
"EventId": this.postEvent.EventId,
"CalendarDestinationName": this.postEvent.CalendarName,
}
try {
await this.eventsService.changeAgenda(body).toPromise();
} catch (error) {}
finally {
this.goBack();
}
}
try {
await this.eventsService.changeAgenda(body).toPromise();
} catch (error) {}
finally {
this.goBack();
this.toastService.successMessage();
}, error => {
if(error.status != 0)
this.toastService.badRequest()
});
} else {
this.eventsService.editEvent(this.postEvent, 2, 3, this.postEvent.CalendarId).subscribe(async () => {
if(this.initCalendarName != this.postEvent.CalendarName) {
let body = {
"EventId": this.postEvent.EventId,
"CalendarDestinationName": this.postEvent.CalendarName,
}
try {
await this.eventsService.changeAgenda(body).toPromise();
} catch (error) {}
finally {
this.goBack();
}
}
this.toastService.successMessage();
}, error => {
if(error.status != 0)
this.toastService.badRequest()
});
}
}
this.toastService.successMessage();
}, error => {
if(error.status != 0)
this.toastService.badRequest()
});
this.isEventEdited = true;
@@ -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';
@@ -129,7 +128,6 @@ export class NewEventPage implements OnInit {
console.log(this.postEvent);
console.log(this.selectedSegment);
this.getRecurrenceTypes();
if(this.selectedSegment != "Combinada"){
@@ -302,7 +300,7 @@ export class NewEventPage implements OnInit {
if(this.CalendarName == 'MDGPR') {
if(this.loggeduser.Profile == 'MDGPR') {
console.log(this.loggeduser.Profile);
console.log(this.postEvent);
@@ -311,10 +309,12 @@ export class NewEventPage implements OnInit {
console.log(eventId);
}
else if(this.CalendarName == 'PR'){
else if(this.loggeduser.Profile == 'PR') {
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) => {
@@ -22,6 +22,8 @@ import { StorageService } from 'src/app/services/storage.service';
import { ThemeService } from 'src/app/services/theme.service'
import { RouteService } from 'src/app/services/route.service';
import { Storage } from '@ionic/storage';
import { SessionStore } from 'src/app/store/session.service';
import { CalendarService } from 'src/app/store/calendar.service';
@Component({
@@ -55,7 +57,7 @@ export class ViewEventPage implements OnInit {
header = true
task: ExpedientTaskModalPageNavParamsTask;
LoadedDocument: any = null;
sesseionStora = SessionStore
constructor(
private modalController: ModalController,
/* private navParams: NavParams, */
@@ -75,7 +77,8 @@ export class ViewEventPage implements OnInit {
private storage: StorageService,
public ThemeService: ThemeService,
private RouteService: RouteService,
private ionicStorage: Storage
private ionicStorage: Storage,
private CalendarService: CalendarService
) {
this.isEventEdited = false;
this.loadedEvent = new Event();
@@ -96,13 +99,6 @@ export class ViewEventPage implements OnInit {
}
});
/* this.activatedRoute.queryParams.subscribe(params => {
if(params["eventId"]) {
this.eventId = params["eventId"];
console.log(params["eventId"]);
}
}); */
}
ngOnInit() {
@@ -137,6 +133,23 @@ export class ViewEventPage implements OnInit {
}
getEventsFromDB () {
return new Promise((resolve, reject) => {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storage.get('agendaResponse').then((events) => {
resolve(events)
})
} else {
this.sqliteservice.getAllEvents().then((events: any[]) => {
resolve(events)
})
}
})
}
close() {
this.modalController.dismiss(this.isEventEdited);
@@ -166,51 +179,108 @@ export class ViewEventPage implements OnInit {
loadEvent() {
const loader = this.toastService.loading();
this.eventsService.getEvent(this.eventId).subscribe(res => {
this.loadedEvent = res;
this.addEventToDb(res);
console.log('Loaded one event', res)
/* this.today = new Date(res.StartDate);
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]); */
loader.remove()
}, (error) => {
console.log('errorstatus ss',error.status)
if (error.status === 0) {
this.getFromDb();
} else {
this.toastService.badRequest('Este evento já não existe na sua agenda')
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
this.eventsService.getEvent(this.eventId).subscribe(res => {
this.loadedEvent = res;
this.addEventToDb(res);
console.log('Loaded one event', res)
/* this.today = new Date(res.StartDate);
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]); */
loader.remove()
this.modalController.dismiss('Eevent not Foud');
this.RouteService.goBack();
}, (error) => {
console.log('errorstatus ss',error.status)
if (error.status === 0) {
this.getFromDb();
} else {
this.toastService.badRequest('Este evento já não existe na sua agenda')
loader.remove()
this.modalController.dismiss('Eevent not Foud');
this.RouteService.goBack();
}
loader.remove()
});
} else {
const event = this.CalendarService.eventSource.find((ele) => ele.id == this.eventId)
// console.log('View event details', event)
if(event?.CalendarId) {
this.eventsService.genericGetEvent(this.eventId, event.CalendarId).subscribe(res => {
this.loadedEvent = res;
this.addEventToDb(res);
console.log('Loaded one event', res)
/* this.today = new Date(res.StartDate);
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]); */
loader.remove()
}, (error) => {
console.log('errorstatus ss',error.status)
if (error.status === 0) {
this.getFromDb();
} else {
this.toastService.badRequest('Este evento já não existe na sua agenda')
loader.remove()
this.modalController.dismiss('Eevent not Foud');
this.RouteService.goBack();
}
loader.remove()
});
}
loader.remove()
});
}
}
deleteEvent() {
const loader = this.toastService.loading()
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => {
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'Evento removido',
buttons: ['OK']
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => {
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'Evento removido',
buttons: ['OK']
});
setTimeout(() => {
alert.dismiss();
}, 1500);
this.goBack();
this.toastService.successMessage('Evento apagado');
}, () => { },
() => {
loader.remove();
});
} else {
this.eventsService.genericDeleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName, this.loadedEvent.CalendarId).subscribe(async () => {
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'Evento removido',
buttons: ['OK']
});
setTimeout(() => {
alert.dismiss();
}, 1500);
this.goBack();
this.toastService.successMessage('Evento apagado');
}, () => { },
() => {
loader.remove();
});
setTimeout(() => {
alert.dismiss();
}, 1500);
this.goBack();
this.toastService.successMessage('Evento apagado');
}, () => { },
() => {
loader.remove();
});
loader.remove();
}
}
@@ -65,6 +65,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>
@@ -108,6 +116,12 @@
<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>
<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 class="file add-attachment-bg-color" *ngIf="msg.file.type != 'application/audio'">
@@ -115,6 +129,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>
@@ -138,6 +153,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>
@@ -359,3 +359,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,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';
import { File } from '@awesome-cordova-plugins/file/ngx';
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
@@ -87,6 +88,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
durationDisplay = '';
duration = 0;
showAvatar = true;
audioPermissionStatus: 'granted'| 'denied' | 'prompt' | null = null
constructor(
private menu: MenuController,
@@ -113,6 +115,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
private processesService: ProcessesService,
private CameraService: CameraService,
private sanitiser: DomSanitizer,
private alertController: AlertController,
private file: File,
private fileOpener: FileOpener,
) {
@@ -165,9 +168,9 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
message: '',
status: status,
}
this.chatService.setUserStatus(body).subscribe(res => {
console.log(res);
})
// this.chatService.setUserStatus(body).subscribe(res => {
// console.log(res);
// })
}
deleteMessage(msgId: string) {
@@ -374,15 +377,15 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
getRoomInfo() {
this.showLoader = true;
this.chatService.getRoomInfo(this.roomId).subscribe(room => {
this.room = room['room'];
this.roomName = this.room.name.split('-').join(' ');
if (this.room.customFields.countDownDate) {
this.roomCountDownDate = this.timeService.countDownDateTimer(this.room.customFields.countDownDate, this.room._id);
}
this.getGroupContacts(this.room);
this.showLoader = false;
});
// this.chatService.getRoomInfo(this.roomId).subscribe(room => {
// this.room = room['room'];
// this.roomName = this.room.name.split('-').join(' ');
// if (this.room.customFields.countDownDate) {
// this.roomCountDownDate = this.timeService.countDownDateTimer(this.room.customFields.countDownDate, this.room._id);
// }
// this.getGroupContacts(this.room);
// this.showLoader = false;
// });
}
async getChatMembers() {
+22 -7
View File
@@ -46,11 +46,6 @@
<ion-content>
<!-- <ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
<ion-refresher-content>
</ion-refresher-content>
</ion-refresher> -->
<div (click)="handleClick()" class="messages" #scrollMe>
<div class="messages-list-item-wrapper container-width-100"
*ngFor="let msg of wsChatMethodsService.getDmRoom(this.roomId).messages; let last = last"
@@ -62,8 +57,13 @@
<span class="time">{{msg.duration}}</span>
</div>
<div>
<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>
@@ -80,6 +80,12 @@
<div *ngFor="let file of msg.attachments let i = index">
<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-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>
<ion-icon *ngIf="msg.attachments[0].image_url == null" name="download-outline"></ion-icon>
</div>
<div *ngIf="msg.file.type != 'application/img'">
@@ -118,6 +124,15 @@
<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>
@@ -328,3 +328,31 @@ button::-moz-focus-inner {
padding: 0px;
border: 0px;
}
.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;
}
+29 -28
View File
@@ -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';
@@ -41,7 +41,6 @@ import { Storage } from '@ionic/storage';
import { FileToBase64Service } from 'src/app/services/file/file-to-base64.service';
import { Camera, CameraResultType, CameraSource } from '@capacitor/camera';
import { Plugins, Capacitor } from '@capacitor/core';
import { MultipleDocumentsPicker } from '@awesome-cordova-plugins/multiple-document-picker/ngx';
import { DomSanitizer } from '@angular/platform-browser';
import { StringDecoder } from 'string_decoder';
import { File } from '@awesome-cordova-plugins/file/ngx';
@@ -109,6 +108,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
base64File: string;
downloadProgess: number;
audioPermissionStatus: 'granted'| 'denied' | 'prompt' | null = null
constructor(
public popoverController: PopoverController,
private modalController: ModalController,
@@ -133,12 +134,11 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
private processesService: ProcessesService,
private storage: Storage,
private fileToBase64Service: FileToBase64Service,
private multipleDocumentsPicker: MultipleDocumentsPicker,
private sant: DomSanitizer,
private file: File,
private fileOpener: FileOpener,
//private fileOpener: FileOpener,
private sanitiser: DomSanitizer,
private document: DocumentViewer
private alertController: AlertController,
// private document: DocumentViewer
) {
this.loggedUser = authService.ValidatedUserChat['data'];
this.roomId = this.navParams.get('roomId');
@@ -148,7 +148,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
if (window.innerWidth > 701) {
this.modalController.dismiss();
}
};
}
console.log(this.wsChatMethodsService.getDmRoom(this.roomId).loadHistory({}));
@@ -160,6 +160,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.scrollToBottomClicked()
}, 150)
}
ngOnInit() {
@@ -956,27 +957,27 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
openFile(pdfString, filename, type) {
const blob = this.b64toBlob(pdfString, type)
let pathFile = ''
const fileName = filename
const contentFile = blob
if (this.platform.is('ios')) {
pathFile = this.file.documentsDirectory
} else {
pathFile = this.file.externalRootDirectory
}
console.log(pdfString)
console.log(pathFile)
console.log(contentFile)
this.file
.writeFile(pathFile, fileName, contentFile, { replace: true })
.then(success => {
this.fileOpener
.open(pathFile + fileName, type)
.then(() => console.log('File is opened'))
.catch(e => console.log('Error opening file', e));
})
.catch(e => console.log('Error writing file', e))
// const blob = this.b64toBlob(pdfString, type)
// let pathFile = ''
// const fileName = filename
// const contentFile = blob
// if (this.platform.is('ios')) {
// pathFile = this.file.documentsDirectory
// } else {
// pathFile = this.file.externalRootDirectory
// }
// console.log(pdfString)
// console.log(pathFile)
// console.log(contentFile)
// this.file
// .writeFile(pathFile, fileName, contentFile, { replace: true })
// .then(success => {
// this.fileOpener
// .open(pathFile + fileName, type)
// .then(() => console.log('File is opened'))
// .catch(e => console.log('Error opening file', e));
// })
// .catch(e => console.log('Error writing file', e))
}
downloadFileFromBrowser(fileName: string, data: any): void {
+11 -5
View File
@@ -185,7 +185,7 @@ export class InactivityPage implements OnInit {
SessionStore.setInativity(true)
this.goback()
setTimeout(()=>{
setTimeout(() => {
this.clearCode()
}, 1000)
@@ -201,16 +201,22 @@ export class InactivityPage implements OnInit {
if(pathName) {
this.router.navigate([pathName],{replaceUrl: true});
} else {
this.router.navigate(['/home/events'], {replaceUrl: true});
setTimeout(()=>{
this.router.navigate(['/home/events'], {replaceUrl: true});
}, 5000)
}
}
storePin() {
const code = this.code.join('');
SessionStore.setPin(code);
this.router.navigate(['/home/events']);
setTimeout(()=>{
const code = this.code.join('');
SessionStore.setPin(code);
this.router.navigate(['/home/events']);
}, 5000)
}
+3 -1
View File
@@ -138,8 +138,8 @@ export class LoginPage implements OnInit {
}
this.getToken();
this.router.navigateByUrl('/pin', { replaceUrl: true });
this.router.navigateByUrl('/pin', { replaceUrl: true });
}
}
else{
@@ -153,6 +153,8 @@ export class LoginPage implements OnInit {
else {
this.toastService._badRequest('Por favor, insira o seu nome de utilizador');
}
}
goback() {
+2 -1
View File
@@ -199,7 +199,8 @@ export class ListBoxService {
EndDate: event.event.EndDate,
Location: event.event.Location,
EventId: event.event.EventId,
CalendarName: event.event.CalendarName
CalendarName: event.event.CalendarName,
CalendarId: event.event.CalendarId
},
Subject: event.event.Subject,
startMany: false,
+30 -9
View File
@@ -55,8 +55,6 @@ export class AuthService {
if (SessionStore.exist) {
this.ValidatedUser = SessionStore.user
// console.log('login', SessionStore.user.RochetChatUser, SessionStore.user.Password)
if(this.p.userPermission(this.p.permissionList.Chat.access) == true ){
this.loginToChatWs()
}
@@ -101,9 +99,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
@@ -117,6 +132,8 @@ export class AuthService {
return true;
}
this.initialsService.getInitials(session.FullName);
}
//Login to rocketChat server2
@@ -135,7 +152,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);
@@ -162,6 +179,10 @@ export class AuthService {
SessionStore.user.RochetChatUserId = message.result.id
SessionStore.save()
// console.log('user session', SessionStore.user)
this.WsChatService.setStatus('online')
}).catch((message) => {
@@ -215,7 +236,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();
@@ -224,7 +245,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), ''));
@@ -236,7 +257,7 @@ export class AuthService {
}
await this.storage.set(message.file.guid, downloadFile).then(() => {
console.log('IMAGE SAVED')
// console.log('IMAGE SAVED')
});
return true
}
@@ -279,8 +300,8 @@ export class AuthService {
this.userData$.next('');
this.router.navigate(['']);
}) */
}
async presentAlert(message: string) {
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
+13 -9
View File
@@ -30,21 +30,25 @@ export class ChatService {
private authService: AuthService,
private storage: Storage,
private storageService:StorageService,
public p:PermissionService
)
{
public p: PermissionService) {
if(this.p.userPermission(this.p.permissionList.Chat.access)){
this.loggedUserChat = authService.ValidatedUserChat;
this.headers = new HttpHeaders();
this.headers = this.headers.set('X-User-Id', this.loggedUserChat['data'].userId);
this.headers = this.headers.set('X-Auth-Token', this.loggedUserChat['data'].authToken);
this.options = {
headers: this.headers,
};
}
if(this.p.userPermission(this.p.permissionList.Chat.access)) {
this.headers = this.headers.set('X-User-Id', this.loggedUserChat['data'].userId);
this.headers = this.headers.set('X-Auth-Token', this.loggedUserChat['data'].authToken);
this.options = {
headers: this.headers,
};
}
}
}
getDocumentDetails(url:string){
let headersc = new HttpHeaders();
headersc = headersc.set('X-User-Id', this.loggedUserChat['data'].userId);
@@ -162,9 +162,9 @@ export class WsChatMethodsService {
} catch(e){}
setTimeout(()=>{
setTimeout(() => {
this.sortRoomList()
}, 1000)
}, 10000)
}
@@ -213,6 +213,11 @@ export class WsChatMethodsService {
setTimeout(()=>{
this.sortRoomList()
}, 1000)
setTimeout(()=>{
this.sortRoomList()
}, 10000)
this.loadingWholeList = false
}
+382 -30
View File
@@ -28,9 +28,21 @@ export class EventsService {
headersMdOficial: HttpHeaders;
headersMdPessoal: HttpHeaders;
headerOwnOficial: HttpHeaders;
headerOwnPessoal: 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.headerOwnPessoal= new HttpHeaders();
this.headerSharedOficial= new HttpHeaders();
this.headerSharedPessoal= new HttpHeaders();
this.setHeader()
this.changeProfileService.registerCallback(() => {
this.loggeduser = this.user.ValidatedUser;
@@ -61,10 +80,22 @@ 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 +110,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 +132,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 +151,55 @@ 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);
this.headerOwnOficial = this.headerOwnOficial.set('CalendarName', calendar.CalendarName);
}
else if (calendar.CalendarName == 'Pessoal') {
this.headerOwnPessoal = this.headerOwnPessoal.set('Authorization', this.loggeduser.BasicAuthKey);
this.headerOwnPessoal =this.headerOwnPessoal.set('CalendarId', calendar.CalendarId);
this.headerOwnPessoal =this.headerOwnPessoal.set('CalendarRoleId', calendar.CalendarRoleId);
this.headerOwnPessoal = this.headerOwnPessoal.set('CalendarName', calendar.CalendarName);
}
});
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') {
sharedCalendar.CalendarName
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);
this.headerSharedOficial = this.headerSharedOficial.set('CalendarName', sharedCalendar.CalendarName);
}
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);
this.headerSharedPessoal = this.headerSharedPessoal.set('CalendarName', sharedCalendar.CalendarName);
}
}
}
this.headers = new HttpHeaders();
@@ -113,20 +207,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 +288,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.headerOwnPessoal,
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();
@@ -293,6 +460,39 @@ export class EventsService {
return this.http.get<Event>(`${geturl}`, options);
}
genericGetEvent(eventid: string, calendarId: string) {
let geturl = environment.apiURL + 'calendar/GetEvent';
let params = new HttpParams();
params = params.set("EventId", eventid);
const headers = [
this.headerSharedOficial,
this.headerSharedPessoal,
this.headerOwnPessoal,
this.headerOwnOficial
]
const header = headers.find((header)=> {
return header?.get('CalendarId')?.includes(calendarId)
})
if(header) {
let options = {
headers: header,
params: params
}
return this.http.get<Event>(`${geturl}`, options);
} else {
}
throw('error')
}
putEvent(event: Event, conflictResolutionMode: number, sendInvitationsOrCancellationsMode: number, sharedagenda: string): Observable<Event> {
const puturl = environment.apiURL + 'calendar/' + ((sharedagenda != '') ? sharedagenda : 'PutEvent');
@@ -309,7 +509,7 @@ export class EventsService {
return this.http.put<Event>(`${puturl}`, event, options)
}
editEvent(event: Event, conflictResolutionMode: number, sendInvitationsOrCancellationsMode: number): Observable<Event> {
editEvent(event: Event, conflictResolutionMode: number, sendInvitationsOrCancellationsMode: number, CalendarId? ): Observable<Event> {
let arrayReq = [];
arrayReq.push(event);
const puturl = environment.apiURL + 'calendar/PutEvent';
@@ -328,6 +528,20 @@ export class EventsService {
}
else if (this.loggeduser.Profile == 'PR') {
this.headers = this.headersPrOficial;
} else {
const headers = [
this.headerSharedOficial,
this.headerSharedPessoal,
this.headerOwnPessoal,
this.headerOwnOficial
]
const header = headers.find((header)=> {
return header?.get('CalendarId')?.includes(CalendarId)
})
this.headers = header
}
}
else {
@@ -337,6 +551,20 @@ export class EventsService {
else if (this.loggeduser.Profile == 'PR') {
this.headers = this.headersPrPessoal;
}
else {
const headers = [
this.headerSharedOficial,
this.headerSharedPessoal,
this.headerOwnPessoal,
this.headerOwnOficial
]
const header = headers.find((header)=> {
return header?.get('CalendarId')?.includes(CalendarId)
})
this.headers = header
}
}
let options = {
@@ -352,6 +580,7 @@ export class EventsService {
})
)
}
changeAgenda(body: any) {
const puturl = environment.apiURL + 'Calendar/MoveEvent';
@@ -361,21 +590,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 +646,58 @@ 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;
if(this.hasOwnCalendar) {
switch (calendarName) {
case 'Oficial':
options = {
headers: this.headerOwnOficial,
params: params
};
break;
case 'Pessoal':
options = {
headers: this.headerOwnPessoal,
params: params
};
break;
}
} else {
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 = {
@@ -488,6 +754,92 @@ export class EventsService {
})
)
}
genericDeleteEvent(eventid: string, eventDeleteType: number, calendarName: string, calendarId: string) {
let arrayReq = [];
let Object = {
eventid: eventid,
eventDeleteType: eventDeleteType,
calendarName: calendarName
}
arrayReq.push(Object)
const puturl = environment.apiURL + 'calendar/DeleteEvent';
let params = new HttpParams();
params = params.set("EventId", eventid);
// 0 for occurence and 1 for serie (delete all events)
params = params.set("eventDeleteType", eventDeleteType.toString());
let options;
if(this.loggeduser.Profile == 'MDGPR') {
if (calendarName == 'Pessoal') {
options = {
headers: this.headersMdPessoal,
params: params
};
}
else if (calendarName == 'Oficial') {
options = {
headers: this.headersMdOficial,
params: params
};
}
}
else if (this.loggeduser.Profile == 'PR') {
if (calendarName == 'Pessoal') {
options = {
headers: this.headersPrPessoal,
params: params
};
}
else if (calendarName == 'Oficial') {
options = {
headers: this.headersPrOficial,
params: params
};
}
}
else {
const headers = [
this.headerSharedOficial,
this.headerSharedPessoal,
this.headerOwnPessoal,
this.headerOwnOficial
]
const header = headers.find((header)=> {
return header?.get('CalendarId')?.includes(calendarId)
})
if (header) {
options = {
headers: header,
params: params
};
return this.http.delete(`${puturl}`, options).pipe(
catchError(err => {
console.log('Event edit saved offline')
this.offlinemanager.storeRequestData('eventDelete', arrayReq);
throw new Error(err);
})
)
} else {
}
throw('header not found')
}
}
postExpedientEvent(docId: any, body: any, sharedagenda: string, serialNumber: any, applicationID: any) {
const geturl = environment.apiURL + 'calendar/' + ((sharedagenda != '') ? sharedagenda : 'CreateEventExpediente') + '/event';
let params = new HttpParams();
+17
View File
@@ -35,6 +35,23 @@ export class PermissionService {
return false;
}
userPermissionCount(args) {
if(!Array.isArray(args)) {
args = [args]
}
let count = 0
for(let permission of (this.SessionStore.user.UserPermissions || [])) {
if (args.includes(permission)) {
count++;
}
}
return count;
}
role(args: any) {
let UserRoleIsValid = this.userRole(args)
@@ -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'">
+13 -13
View File
@@ -21,20 +21,19 @@ export class CalendarService {
let restore = this.localstoreService.get(this.keyName, [])
setTimeout(()=>{
restore.forEach((element:EventListStore, eventIndex) => {
this._eventSource.push({
startTime: new Date(element.startTime),
endTime: new Date(element.endTime),
allDay: element.allDay,
event: element.event,
calendarName: element.calendarName,
profile: element.profile,
id: element.id,
});
restore.forEach((element:EventListStore, eventIndex) => {
this._eventSource.push({
startTime: new Date(element.startTime),
endTime: new Date(element.endTime),
allDay: element.allDay,
event: element.event,
calendarName: element.calendarName,
CalendarId: element.CalendarId,
profile: element.profile,
id: element.id,
});
},10)
});
}
@@ -75,6 +74,7 @@ export class CalendarService {
calendarName: element.CalendarName,
profile: profile,
id: element.EventId,
CalendarId: element.CalendarId
});
});
+23
View File
@@ -95,6 +95,29 @@ class SessionService {
})
}
get getInitials() {
let names = this._user.FullName.split(' ') || ' ',
initials = names[0].substring(0, 1).toUpperCase();
if (names.length > 1) {
initials += names[names.length - 1].substring(0, 1).toUpperCase();
}
return initials;
}
get getManagerInitials() {
let names = this._user.ManagerName.split(' ') || ' ',
initials = names[0].substring(0, 1).toUpperCase();
if (names.length > 1) {
initials += names[names.length - 1].substring(0, 1).toUpperCase();
}
return initials;
}
}
@@ -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

+17
View File
@@ -2,6 +2,23 @@
// `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/',