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
+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() {