This commit is contained in:
tiago.kayaya
2021-06-16 13:29:57 +01:00
parent 3435354f55
commit 16c8e27d34
6 changed files with 195 additions and 132 deletions
+16 -9
View File
@@ -347,7 +347,7 @@ export class AgendaPage implements OnInit {
get CalendarCurrentDay ():any {
console.log(this.viewDate.getDate(), '0_0')
/* console.log(this.viewDate.getDate(), '0_0') */
return this.viewDate.getDate()
}
@@ -530,10 +530,10 @@ export class AgendaPage implements OnInit {
//Inicializa o array eventSource
//this.eventSource=[];
if(this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR' ) {
if(this.loggeduser.Profile == 'MDGPR' ) {
let mdOficialEvents = await this.eventService.getAllPrOficialEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).toPromise();
let mdPessoalEvents = await this.eventService.getAllPrPessoalEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).toPromise();
let mdOficialEvents = await this.eventService.getAllMdOficialEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).toPromise();
let mdPessoalEvents = await this.eventService.getAllMdPessoalEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).toPromise();
// calendar
this.eventSource=[];
@@ -708,7 +708,7 @@ export class AgendaPage implements OnInit {
//Inicializa o array eventSource
this.eventsListOficial = [];
if(this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR') {
if(this.loggeduser.Profile == 'MDGPR') {
this.eventService.getAllMdOficialEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe(res => {
this.eventSource=[];
this.eventsListOficial = res.filter(data => data.CalendarName == "Oficial");
@@ -742,7 +742,8 @@ export class AgendaPage implements OnInit {
this.timelineBoxCorrectHeight(500);
this.centralizeTimeline(500);
});
} else {
}
else {
let prOficialEvents= await this.eventService.getAllPrOficialEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).toPromise();
this.eventSource=[];
this.eventsListOficial = prOficialEvents.filter(data => data.CalendarName == "Oficial");
@@ -779,7 +780,8 @@ export class AgendaPage implements OnInit {
break;
}
} else {
}
else {
//this.showTimelinePR = false;
//this.showTimelineMD = false;
@@ -789,8 +791,8 @@ export class AgendaPage implements OnInit {
if(this.loggeduser.Profile == 'MDGPR') {
let mdOficialEvents = await this.eventService.getAllPrOficialEvents( momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59') ).toPromise();
let mdPessoalEvents = await this.eventService.getAllPrPessoalEvents( momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59') ).toPromise();
let mdOficialEvents = await this.eventService.getAllMdOficialEvents( momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59') ).toPromise();
let mdPessoalEvents = await this.eventService.getAllMdPessoalEvents( momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59') ).toPromise();
if(this.segment == 'Oficial') {
this.eventsList = mdOficialEvents;
@@ -842,6 +844,9 @@ export class AgendaPage implements OnInit {
}
else{
let prOficialEvents= await this.eventService.getAllPrOficialEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).toPromise();
let prPessoalEvents= await this.eventService.getAllPrPessoalEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).toPromise();
@@ -890,6 +895,8 @@ export class AgendaPage implements OnInit {
this.timelineBoxCorrectHeight(500);
this.centralizeTimeline(500);
}
}
}
}
@@ -4,7 +4,9 @@ import { EventAttachment } from 'src/app/models/attachment.model';
import { EventBody } from 'src/app/models/eventbody.model';
import { EventPerson } from 'src/app/models/eventperson.model';
import { SearchDocument } from 'src/app/models/search-document';
import { User } from 'src/app/models/user.model';
import { AttachmentsService } from 'src/app/services/attachments.service';
import { AuthService } from 'src/app/services/auth.service';
import { EventsService } from 'src/app/services/events.service';
import { ToastService } from 'src/app/services/toast.service';
import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page';
@@ -36,6 +38,8 @@ export class NewEventPage implements OnInit {
documents:SearchDocument[] = [];
loggeduser: User;
constructor(
private modalController: ModalController,
private navParams: NavParams,
@@ -43,11 +47,13 @@ export class NewEventPage implements OnInit {
private attachmentsService: AttachmentsService,
private animationController: AnimationController,
private toastService: ToastService,
userService: AuthService,
) {
this.loggeduser = userService.ValidatedUser;
this.postEvent = new Event();
this.eventBody = { BodyType : "1", Text : ""};
this.postEvent.Body = this.eventBody;
this.profile = this.navParams.get('profile');
/* this.profile = this.navParams.get('profile'); */
this.selectedSegment = this.navParams.get('segment');
this.selectedDate = this.navParams.get('eventSelectedDate');
@@ -126,14 +132,20 @@ export class NewEventPage implements OnInit {
this.postEvent.HasAttachments = true;
}
let eventId: string;
let eventId: any;
try {
if(this.profile=='mdgpr') {
if(this.loggeduser.Profile == 'MDGPR') {
console.log(this.loggeduser.Profile);
eventId = await this.eventService.postEventMd(this.postEvent, this.postEvent.CalendarName).toPromise();
console.log(eventId);
}
else if(this.profile=='pr'){
else if(this.loggeduser.Profile == 'PR'){
console.log(this.loggeduser.Profile);
eventId = await this.eventService.postEventPr(this.postEvent, this.postEvent.CalendarName).toPromise();
}
@@ -170,74 +182,6 @@ export class NewEventPage implements OnInit {
}
async successMessage(message?: any, callback?) {
var notification = document.createElement('div')
notification.id = 'notification'
notification.innerHTML = `
<div class="main-content width-100 pa-20">
<p class="message d-flex align-center">
<ion-icon slot="end" class="title-icon pr-10" src="/assets/images/nofitication-success.svg"></ion-icon>
<p class="text">{{ message }}</p>
</p>
</div>
`
document.body.append(notification)
notification.querySelector('.text').innerHTML = message || 'Processo efetuado'
setTimeout(()=>{
notification.remove()
},7000)
}
async badRequest(message?: string, callback?) {
const enterAnimation = (baseEl: any) => {
const backdropAnimation = this.animationController.create()
.addElement(baseEl.querySelector('ion-backdrop')!)
.fromTo('opacity', '0.01', 'var(--backdrop-opacity)');
const wrapperAnimation = this.animationController.create()
.addElement(baseEl.querySelector('.modal-wrapper')!)
.keyframes([
{ offset: 0, opacity: '1', right: '-100%' },
{ offset: 1, opacity: '1', right: '0px' }
]);
return this.animationController.create()
.addElement(baseEl)
.easing('ease-out')
.duration(500)
.addAnimation([backdropAnimation, wrapperAnimation]);
}
const leaveAnimation = (baseEl: any) => {
return enterAnimation(baseEl).direction('reverse');
}
const modal = await this.modalController.create({
enterAnimation,
leaveAnimation,
component: BadRequestPage,
componentProps: {
message: message || 'Processo efetuado' ,
},
cssClass: 'notification-modal'
});
modal.present()
setTimeout(()=>{
if (callback) {
callback()
}
modal.dismiss()
},7000)
}
async openAttendees() {
const modal = await this.modalController.create({