Merge branch 'developer' into developer_mobilefirst

This commit is contained in:
Eudes Inácio
2021-06-18 11:24:26 +01:00
74 changed files with 1709 additions and 1891 deletions
+30 -29
View File
@@ -99,12 +99,14 @@
<!-- Adding a customized ng-template -->
<ng-template #template let-view="view" let-row="row" let-col="col">
<div [className]="currentDayEventDisplayBorder(view.dates, row*7+col)" class="d-flex justify-center align-center" [class.with-event]="view.dates[row*7+col].events.length">
<div class="day">
{{ view.dates[row*7+col].label }}
</div>
<div class="day-container">
<div [className]="currentDayEventDisplayBorder(view.dates, row*7+col)" class="d-flex justify-center align-center" [class.with-event]="view.dates[row*7+col].events.length">
<div class="day">
<div class="number"> {{ view.dates[row*7+col].label }}</div>
</div>
</div>
</div>
</ng-template>
</div>
@@ -116,12 +118,12 @@
</div>
<!-- Calendar currente date -->
<ion-row class="timeline-header ion-justify-content-between ion-align-items-center currente-date-timelien pb-5">
<ion-row class="timeline-header pb-0 ion-justify-content-between ion-align-items-center currente-date-timelien">
<ion-row class="timeline-date align-center">
<button class="btn-no-color" *ngIf="showCalendar" (click)="calendarHeight='75px';showCalendar=false">
<ion-icon class="collaps btn-no-color" src="assets/images/icons-collaps-up.svg" ></ion-icon>
</button>
<button class="collaps btn-no-color" *ngIf="!showCalendar" (click)="calendarHeight='333px';showCalendar=true">
<button class="collaps btn-no-color" *ngIf="!showCalendar" (click)="calendarHeight='317px';showCalendar=true">
<ion-icon src="assets/images/icons-collaps-down.svg" ></ion-icon>
</button >
@@ -147,7 +149,7 @@
</ion-row>
</ion-row>
<div class="pb-5 d-none d-md-flex" *ngIf="loggeduser.Profile == 'MDGPR'">
<div class="d-none d-md-flex" *ngIf="loggeduser.Profile == 'MDGPR'">
<div class="flex-grow-1 text-grey d-flex justify-center align-center">
<div>Própria</div>
</div>
@@ -171,7 +173,7 @@
<!-- Timeline -->
<div class="height-100">
<div class="timeline-container height-100 d-flex pt-20 pa-20 filter-{{segment}}" >
<div class="timeline-container height-100 d-flex pt-20 pl-20 pl-20 filter-{{segment}}" >
<!-- <div [ngSwitch]="view" class="ss-timeline timeline-mobile flex-grow-1 d-md-none">
<mwl-calendar-day-view
@@ -213,18 +215,18 @@
</div>
</div> -->
<div class="ss-timeline timeline-mobile flex-grow-1 d-md-none text-black height-100 width-100 overflow-y-auto" >
<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 *ngIf="CalendarCurrentDay <= events.key">
<div class="EventListBox-container" *ngIf="CalendarCurrentDay <= events.key">
<div class="day mt-10">
{{ TimelineDayEvent(events.key)}}
</div>
<div *ngFor="let event of events.value" >
<div *ngFor="let event of events.value" class="EventListBox">
<div class="d-flex content-{{event.profile}}-{{event.event.CalendarName}} mt-10 cursor-pointer width-100 " (click)="eventClicked(event)" >
<div class="d-flex content-{{event.profile}}-{{event.event.CalendarName}} mt-10 cursor-pointer width-100 " (click)="eventClicked(event)"
*ngIf="viewEventMonth <= dateMonth(event)">
<div class="schedule-time" *ngIf="!event.event.IsAllDayEvent">
<div *ngIf="!event.endMany && !event.middle" class="time-start">{{event.event.StartDate | date: 'HH:mm'}}</div>
@@ -252,22 +254,20 @@
</div>
</div>
</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="loggeduser.Profile == 'MDGPR'">
<div *ngFor="let events of TimelineMDList | keyvalue;" >
<div *ngIf="CalendarCurrentDay <= events.key">
<div class="day mt-10">
<div class="EventListBox-container" *ngIf="CalendarCurrentDay <= events.key">
<div class="day EventListBox-day mt-10">
{{ TimelineDayEvent(events.key)}}
</div>
<div *ngFor="let event of events.value" >
<div class="d-flex content-mdgpr-{{event.event.CalendarName}} mt-10 cursor-pointer" (click)="eventClicked(event)">
<div *ngFor="let event of events.value" class="EventListBox" >
<div class="d-flex content-mdgpr-{{event.event.CalendarName}} mt-10 cursor-pointer" (click)="eventClicked(event)"
*ngIf="viewEventMonth <= dateMonth(event)">
<div class="schedule-time" *ngIf="!event.event.IsAllDayEvent">
<div *ngIf="!event.endMany && !event.middle" class="time-start">{{event.event.StartDate | date: 'HH:mm'}}</div>
<div *ngIf="event.endMany && !event.middle" class="time-start">--</div>
@@ -290,25 +290,26 @@
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sd-timeline flex-grow-1 d-none d-md-block timeline-md text-black pl-20 width-100 height-100 overflow-y-auto" >
<div class="sd-timeline flex-grow-1 d-none d-md-block timeline-md text-black pl-20 pr-20 width-100 height-100 overflow-y-auto" >
<div *ngFor="let events of TimelinePRList | keyvalue;">
<div *ngIf="CalendarCurrentDay <= events.key">
<div class="EventListBox-container" *ngIf="CalendarCurrentDay <= events.key">
<div class="day mt-10">
{{ TimelineDayEvent(events.key)}}
</div>
<div *ngFor="let event of events.value" >
<div *ngFor="let event of events.value" class="EventListBox">
<div class="d-flex content-pr-{{event.event.CalendarName}} mt-10 cursor-pointer" (click)="eventClicked(event)">
<div class="d-flex content-pr-{{event.event.CalendarName}} mt-10 cursor-pointer" (click)="eventClicked(event)"
*ngIf="viewEventMonth <= dateMonth(event)">
<div class="schedule-time" *ngIf="!event.event.IsAllDayEvent">
<div *ngIf="!event.endMany && !event.middle" class="time-start">{{event.event.StartDate | date: 'HH:mm'}}</div>
<div *ngIf="event.endMany && !event.middle" class="time-start">--</div>
+8 -20
View File
@@ -7,19 +7,6 @@
display: table-cell;
}
ion-slide{
td{
div {
padding-left: 7px;
border-radius: 28px;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
height: 25px;
}
}
}
:host ::ng-deep {
.monthview-primary-with-event {
@@ -388,11 +375,13 @@ td.monthview-primary-with-event {
}
.custom-calendar-header{
.custom-calendar-header {
width: 100%;
margin-bottom: 10px;
thead{
th{
thead {
display: flex;
justify-content: space-around;
th {
font-family: Roboto;
font-size: 15px;
color: rgba(52, 72, 94, 0.54);
@@ -403,8 +392,6 @@ td.monthview-primary-with-event {
.currente-date-timelien{
padding: 10px 20px;
.timeline-date{
@@ -706,7 +693,7 @@ app-approve-event{
.fs-timeline {
border-right: 2px solid #909090;
border-right: 1px solid #909090;
}
@@ -721,4 +708,5 @@ app-approve-event{
display: none !important;
}
}
}
+269 -315
View File
@@ -162,7 +162,7 @@ export class AgendaPage implements OnInit {
this.loggeduser = authService.ValidatedUser;
this.calendarHeight = "333px";
this.calendarHeight = "317px";
this.showCalendar = true;
this.timelineDate = momentG(new Date(),'dd MMMM yyyy');
@@ -173,8 +173,7 @@ export class AgendaPage implements OnInit {
if(this.loggeduser.Profile == 'MDGPR') {
this.mobileComponent.showEventList = true;
}
}
ngOnInit() {
@@ -194,7 +193,6 @@ export class AgendaPage implements OnInit {
window.onresize = (event) => {
// if not table remove all component
if( window.innerWidth <= 1024){
console.log('mobile')
this.cloneAllmobileComponent();
}
};
@@ -204,12 +202,10 @@ export class AgendaPage implements OnInit {
//Go to the next view of the calendar month/week/day
next() {
this.myCal.slideNext();
this.centralizeTimeline(500);
}
//Go to the previous view of the calendar
back(){
this.myCal.slidePrev();
this.centralizeTimeline(500);
}
//Shows the title of your view
onViewTitleChanged(title){
@@ -254,7 +250,6 @@ export class AgendaPage implements OnInit {
//Show information of the event
async onEventSelected(ev: { event: Event}){
/* this.viewEventDetail(ev.event.EventId); */
console.log('DOVE');
this.router.navigate(["/home/agenda", ev.event.EventId, 'agenda']);
}
@@ -266,8 +261,6 @@ export class AgendaPage implements OnInit {
// calendar change date
this.eventSelectedDate = new Date(ev);
this.centralizeTimeline(500);
this.timelineBoxCorrectHeight(500);
};
// changedate
@@ -278,7 +271,7 @@ export class AgendaPage implements OnInit {
}
onTimeSelected = (ev: { selectedTime: Date, events: any[] }) => {
console.log('Selected time: ' + ev.selectedTime + ', hasEvents: ' + (ev.events !== undefined && ev.events.length !== 0));
// console.log('Selected time: ' + ev.selectedTime + ', hasEvents: ' + (ev.events !== undefined && ev.events.length !== 0));
this.eventSelectedDate2 = ev.selectedTime;
}
@@ -290,7 +283,7 @@ export class AgendaPage implements OnInit {
}
// for calendar
currentDayEventDisplayBorder(day: any, id: any){
currentDayEventDisplayBorder(day: any, id: any) {
const events = day[id].events;
@@ -318,36 +311,13 @@ export class AgendaPage implements OnInit {
}
// for timeline
centralizeTimeline(timeout: number) {
// auto scroll timeline
if(!this.showLoader) {
setTimeout(() => {
const timelineMarker = document.querySelector('.cal-current-time-marker');
const scrollContainer = document.querySelector('.timeline-wrapper');
try {
scrollContainer.scroll({
top: parseInt(timelineMarker['style']['top'].replace('px','')) - ((scrollContainer['offsetHeight']/2) - 60),
left: 0,
behavior: 'smooth'
})
} catch (error) {
//
if(!this.showLoader) {
//this.selectFirstEventOfTheDay();
}
}
}, timeout);
}
}
get CalendarCurrentDay ():any {
console.log(this.viewDate.getDate(), '0_0')
/* console.log(this.viewDate.getDate(), '0_0') */
// console.log(this.viewDate.getDate(), '0_0')
return this.viewDate.getDate()
}
@@ -393,75 +363,6 @@ export class AgendaPage implements OnInit {
`
}
// for timeline
timelineBoxCorrectHeight(timeout){
setTimeout(()=>{
if(window.innerWidth <= 1024){
this.events.forEach((el:any, eventIndex)=>{
const startEvent = new Date(el.startTime| el.start);
const endEvent = new Date(el.endTime | el.end);
var minutes = ((endEvent.getTime() - startEvent.getTime()) / 1000) / 60;
// const top = (startEvent.getTime() - (new Date(2020, 1, 3)).getTime()) /60;
document.querySelectorAll('.ss-timeline .timeline-box').forEach(ele => {
if(ele.className.indexOf(`timeline-box-event-${eventIndex}`)>=0){
ele.setAttribute('style',`height:${minutes}px`);
}
});
});
} else {
this.TimelineMD.forEach((el:any, eventIndex)=>{
const startEvent = new Date(el.startTime| el.start);
const endEvent = new Date(el.endTime | el.end);
var minutes = ((endEvent.getTime() - startEvent.getTime()) / 1000) / 60;
// const top = (startEvent.getTime() - (new Date(2020, 1, 3)).getTime()) /60;
document.querySelectorAll('.fs-timeline .timeline-box').forEach(ele => {
if(ele.className.indexOf(`timeline-box-event-${eventIndex}`)>=0){
ele.setAttribute('style',`height:${minutes}px`);
}
});
});
}
},timeout)
setTimeout(()=>{
this.TimelinePR.forEach((el, eventIndex)=>{
const startEvent = new Date(el['startTime']);
const endEvent = new Date(el['endTime']);
var minutes = ((endEvent.getTime() - startEvent.getTime()) / 1000) / 60;
const top = (startEvent.getTime() - (new Date(2020, 1, 3)).getTime()) /60;
document.querySelectorAll('.sd-timeline .timeline-box').forEach(ele => {
if(ele.className.indexOf(`timeline-box-event-${eventIndex}`)>=0){
ele.setAttribute('style',`height:${minutes}px`);
}
});
});
},timeout)
}
// for timeline
timelineFilter(calendarName, eventsList, profile){
@@ -515,7 +416,7 @@ export class AgendaPage implements OnInit {
return ((new Date(this.timelineDate)).getDate()).toString().padStart(2,'0')
}
async loadRangeEvents(startTime: Date, endTime: Date){
loadRangeEvents(startTime: Date, endTime: Date){
this.eventSelectedDate = new Date(startTime);
@@ -529,16 +430,17 @@ export class AgendaPage implements OnInit {
case "Combinado":
//Inicializa o array eventSource
//this.eventSource=[];
if(this.profile == "mdgpr" && 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();
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) => {
// calendar
this.eventSource=[];
this.eventsList = mdOficialEvents.concat(mdPessoalEvents);
this.eventsList = response;
// loop
this.eventsList.forEach((element, eventIndex) => {
@@ -571,19 +473,18 @@ export class AgendaPage implements OnInit {
this.showTimeline = true;
this.timelineBoxCorrectHeight(500);
this.centralizeTimeline(500);
});
}
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();
else if(this.profile == "pr" && this.loggeduser.Profile == 'MDGPR'){
console.log('HERE PR');
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) => {
// calendar
this.eventSource=[];
this.eventsList = prOficialEvents.concat(prPessoalEvents);
this.eventsList = response;
// calendar
this.eventsList.forEach((element, eventIndex) => {
@@ -614,9 +515,53 @@ export class AgendaPage implements OnInit {
this.showLoader = false;
this.showTimeline = true;
this.timelineBoxCorrectHeight(500);
this.centralizeTimeline(500);
});
}
else {
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) => {
// calendar
this.eventSource=[];
this.eventsList = response;
// calendar
this.eventsList.forEach((element, eventIndex) => {
this.eventSource.push({
title: element.Subject,
startTime: new Date(element.StartDate),
endTime: new Date(element.EndDate),
allDay: false,
event: element,
calendarName: element.CalendarName,
profile: 'pr',
id: element.EventId,
});
});
const list = this.timelineFilter(this.timelineFilterState, this.eventsList, 'pr');
this.TimelineMDList = this.eventListBox(list)
this.events = list;
this.TimelinePR = list;
this.myCal.update();
this.myCal.loadEvents();
this.showLoader = false;
this.showTimeline = true;
});
}
break;
@@ -624,7 +569,7 @@ export class AgendaPage implements OnInit {
//Inicializa o array eventSource
if(this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR') {
this.eventService.getAllMdPessoalEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe(response => {
this.eventService.getAllMdEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).then((response:any) => {
this.eventSource=[];
this.eventsListPessoal= [];
@@ -659,17 +604,14 @@ export class AgendaPage implements OnInit {
this.showLoader = false;
this.showTimeline = true;
this.timelineBoxCorrectHeight(500);
this.centralizeTimeline(500);
});
}
else{
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();
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) => {
this.eventSource=[];
this.eventsListPessoal = prPessoalEvents.filter(data => data.CalendarName == "Pessoal");
this.eventsListPessoal = response.filter(data => data.CalendarName == "Pessoal");
this.eventsListPessoal.forEach(element => {
this.eventSource.push({
title: element.Subject,
@@ -697,9 +639,7 @@ export class AgendaPage implements OnInit {
this.showLoader = false;
this.showTimeline = true;
this.timelineBoxCorrectHeight(500);
this.centralizeTimeline(500);
});
}
break;
@@ -709,7 +649,7 @@ export class AgendaPage implements OnInit {
this.eventsListOficial = [];
if(this.profile == "mdgpr" && 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.eventService.getAllMdEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).then((res:any) => {
this.eventSource=[];
this.eventsListOficial = res.filter(data => data.CalendarName == "Oficial");
@@ -739,13 +679,11 @@ export class AgendaPage implements OnInit {
this.showLoader = false;
this.showTimeline = true;
this.timelineBoxCorrectHeight(500);
this.centralizeTimeline(500);
});
} 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.eventService.getAllPrEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).then((res:any) => {
this.eventSource=[];
this.eventsListOficial = prOficialEvents.filter(data => data.CalendarName == "Oficial");
this.eventsListOficial = res.filter(data => data.CalendarName == "Oficial");
this.eventsListOficial.forEach(element => {
this.eventSource.push({
title: element.Subject,
@@ -773,8 +711,7 @@ export class AgendaPage implements OnInit {
this.showLoader = false;
this.showTimeline = true;
this.timelineBoxCorrectHeight(500);
this.centralizeTimeline(500);
});
}
break;
@@ -788,16 +725,17 @@ export class AgendaPage implements OnInit {
let counter = 0;
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();
console.log('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) => {
if(this.segment == 'Oficial') {
this.eventsList = mdOficialEvents;
this.eventsList = response.filter(data => data.CalendarName == "Oficial");
} else if (this.segment == 'Pessoal') {
this.eventsList = mdPessoalEvents;
this.eventsList = response.filter(data => data.CalendarName == "Pessoal");
} else {
this.eventsList = mdOficialEvents.concat(mdPessoalEvents);
this.eventsList = response;
}
this.eventSource= this.eventSource.filter(e => e.profile != 'md');
@@ -821,8 +759,6 @@ export class AgendaPage implements OnInit {
const MDEventList = this.timelineFilter(this.timelineFilterState, this.eventsList, 'mdgpr');
this.TimelineMDList = this.eventListBox(MDEventList, 'md')
this.events = MDEventList;
@@ -836,22 +772,72 @@ export class AgendaPage implements OnInit {
counter++;
if(counter==2){
this.showLoader = false;
this.timelineBoxCorrectHeight(500);
this.centralizeTimeline(500);
}
}
});
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();
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) => {
if(this.segment == 'Oficial') {
this.eventsList = response.filter(data => data.CalendarName == "Oficial");
} else if (this.segment == 'Pessoal') {
this.eventsList = response.filter(data => data.CalendarName == "Pessoal");
} else {
this.eventsList = response;
}
this.eventSource = this.eventSource.filter(e => e.profile != 'pr');
this.eventsList.forEach((element, eventIndex) => {
// calendar
this.eventSource.push({
index: eventIndex,
title: element.Subject,
startTime: new Date(element.StartDate),
endTime: new Date(element.EndDate),
allDay: false,
event: element,
calendarName: element.CalendarName,
profile:'pr',
id: element.EventId,
});
});
this.TimelinePR = this.timelineFilter(this.timelineFilterState, this.eventsList, 'pr');
this.TimelinePRList = this.eventListBox(this.TimelinePR)
this.myCal.update();
this.myCal.loadEvents();
this.showTimelinePR = true;
counter++;
if(counter==2 || this.loggeduser.Profile == 'PR') {
this.showLoader = false;
}
});
}else{
console.log('PR');
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) => {
if(this.segment == 'Oficial') {
this.eventsList = prOficialEvents;
this.eventsList = response.filter(data => data.CalendarName == "Oficial");
} else if (this.segment == 'Pessoal') {
this.eventsList = prPessoalEvents;
this.eventsList = response.filter(data => data.CalendarName == "Pessoal");
} else {
this.eventsList = prOficialEvents.concat(prPessoalEvents);
this.eventsList = response;
}
this.eventSource = this.eventSource.filter(e => e.profile != 'pr');
@@ -887,9 +873,11 @@ export class AgendaPage implements OnInit {
if(counter==2 || this.loggeduser.Profile == 'PR') {
this.showLoader = false;
this.timelineBoxCorrectHeight(500);
this.centralizeTimeline(500);
}
});
}
}
}
@@ -899,193 +887,163 @@ export class AgendaPage implements OnInit {
list.forEach( (event:any)=> {
var startDate = new Date(event.start);
var endDate = new Date(event.end);
var startDate: any = new Date(event.start);
var endDate: any = new Date(event.end);
const day = (((new Date (event.start)).getDate())).toString().padStart(2,'0')
event.manyDays = false
if ( (new Date (this.viewDate).getMonth()) == (new Date(event.start).getMonth()) ) {
if(!days.hasOwnProperty(day)) {
days[day] = []
}
if(!days.hasOwnProperty(day)) {
days[day] = []
}
var Difference_In_Days = endDate.getDate() - startDate.getDate()
// difference
const diffTime = Math.abs(endDate - startDate);
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
if ( endDate.getTime() > startDate.getTime() && Difference_In_Days <= 50 && !event.event.IsAllDayEvent ) {
if (Difference_In_Days >= 1) {
if (diffDays <= 150 && !event.event.IsAllDayEvent ) {
if(nice == 'md') {
console.log('md', event)
}
const StartEvent = Object.assign({}, {
title: event.title,
start: event.start,
end: event.end,
color: event.color,
id: event.id,
index: event.index,
profile: event.profile,
CalendarName: event.CalendarName,
event: {
Subject: event.event.Subject,
StartDate: event.event.StartDate,
EndDate: event.event.EndDate,
Location: event.event.Location,
EventId: event.event.EventId,
CalendarName: event.event.CalendarName
},
startMany: true,
endMany: false,
middle: false
})
days[day].push(StartEvent)
let i = 1;
while (startDate.getFullYear() != endDate.getFullYear() ||
startDate.getMonth() != endDate.getMonth() ||
startDate.getDate() != endDate.getDate()) {
if (diffDays >= 1) {
const StartEvent = Object.assign({}, {
title: event.title,
start: event.start,
end: event.end,
color: event.color,
id: event.id,
index: event.index,
profile: event.profile,
CalendarName: event.CalendarName,
event: {
Subject: event.event.Subject,
StartDate: event.event.StartDate,
EndDate: event.event.EndDate,
Location: event.event.Location,
EventId: event.event.EventId,
CalendarName: event.event.CalendarName
},
startMany: true,
endMany: false,
middle: false
})
days[day].push(StartEvent)
let i = 1;
while (startDate.getFullYear() != endDate.getFullYear() ||
startDate.getMonth() != endDate.getMonth() ||
startDate.getDate() != endDate.getDate()) {
const newDate = startDate.setDate(startDate.getDate()+ i)
const newDate = startDate.setDate(startDate.getDate()+ i)
let otherDays = (((new Date (newDate)).getDate())).toString().padStart(2,'0')
event.other = true
let otherDays = (((new Date (newDate)).getDate())).toString().padStart(2,'0')
event.start = newDate
if(!days.hasOwnProperty(otherDays)) {
event.other = true
event.start = newDate
if(!days.hasOwnProperty(otherDays)) {
days[otherDays] = []
}
if (!(startDate.getFullYear() != endDate.getFullYear() ||
startDate.getMonth() != endDate.getMonth() ||
startDate.getDate() != endDate.getDate())) {
// last push
const EndEvent = Object.assign({}, {
title: event.title,
start: event.start,
end: event.end,
color: event.color,
id: event.id,
index: event.index,
profile: event.profile,
CalendarName: event.CalendarName,
event: {
Subject: event.event.Subject,
StartDate: event.event.StartDate,
EndDate: event.event.EndDate,
Location: event.event.Location,
EventId: event.event.EventId,
CalendarName: event.event.CalendarName
},
Subject: event.Subject,
startMany: false,
endMany: true,
middle: false
})
days[otherDays].push(EndEvent)
} else {
const EndEvent = Object.assign({}, {
title: event.title,
start: event.start,
end: event.end,
color: event.color,
id: event.id,
index: event.index,
profile: event.profile,
CalendarName: event.CalendarName,
event: {
Subject: event.event.Subject,
StartDate: event.event.StartDate,
EndDate: event.event.EndDate,
Location: event.event.Location,
EventId: event.event.EventId,
CalendarName: event.event.CalendarName
},
Subject: event.Subject,
startMany: false,
endMany: true,
middle: true
})
days[otherDays].push(EndEvent)
}
days[otherDays] = []
}
if (!(startDate.getFullYear() != endDate.getFullYear() ||
startDate.getMonth() != endDate.getMonth() ||
startDate.getDate() != endDate.getDate())) {
// last push
} else {
days[day].push(event)
const EndEvent = Object.assign({}, {
title: event.title,
start: event.start,
end: event.end,
color: event.color,
id: event.id,
index: event.index,
profile: event.profile,
CalendarName: event.CalendarName,
event: {
Subject: event.event.Subject,
StartDate: event.event.StartDate,
EndDate: event.event.EndDate,
Location: event.event.Location,
EventId: event.event.EventId,
CalendarName: event.event.CalendarName
},
Subject: event.Subject,
startMany: false,
endMany: true,
middle: false
})
days[otherDays].push(EndEvent)
} else {
const EndEvent = Object.assign({}, {
title: event.title,
start: event.start,
end: event.end,
color: event.color,
id: event.id,
index: event.index,
profile: event.profile,
CalendarName: event.CalendarName,
event: {
Subject: event.event.Subject,
StartDate: event.event.StartDate,
EndDate: event.event.EndDate,
Location: event.event.Location,
EventId: event.event.EventId,
CalendarName: event.event.CalendarName
},
Subject: event.Subject,
startMany: false,
endMany: true,
middle: true
})
days[otherDays].push(EndEvent)
}
}
} else {
days[day].push(event)
}
} else {
days[day].push(event)
}
})
setTimeout(()=>{
document.querySelectorAll('.EventListBox-container .EventListBox').forEach((e)=>{
if(e.childElementCount == 0) {
e.parentElement.style.display = 'none'
} else {
e.parentElement.style.display = 'block'
}
})
}, 10)
return days
}
get viewEventMonth () {
return this.viewDate.getMonth()
}
dateMonth(event: any) {
return new Date(event.start).getMonth()
}
eventListVisible(event) {
return momentG(event,'MMMM yyyy') == momentG(this.calendar.currentDate, 'MMMM yyyy')
}
log(event) {
console.log(event)
}
// for timeline select the first event in the timeline
selectFirstEventOfTheDay(){
setTimeout(()=>{
let sortedDate = this.eventSource.sort((a,b) =>{
return (b.startTime) -(a.startTime);
});
let filterDate = sortedDate.filter((e) => {
//console.log( e.startTime.toLocaleDateString('en-US'),' == ',this.eventSelectedDate.toLocaleDateString('en-US'));
return e.startTime.toLocaleDateString('en-US') == this.eventSelectedDate.toLocaleDateString('en-US');
});
// console.log('Event -- ',filterDate[filterDate.length - 1], filterDate['startTime']);
const firstEventStartHours = new Date(filterDate[filterDate.length - 1].startTime).getHours();
// console.log('firstEventStartHours-- ', firstEventStartHours)
if(firstEventStartHours) {
const scrollContainer = document.querySelector('.timeline-wrapper');
scrollContainer.scroll({
top: firstEventStartHours*60,
left: 0,
behavior: 'smooth'
})
}
}, 500);
}
actions(){}
@@ -1103,19 +1061,14 @@ export class AgendaPage implements OnInit {
changeProfile() {
if(this.profile == "mdgpr"){
console.log('pr');
this.profile ="pr";
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
}
else{
console.log('mdgpr');
this.profile ="mdgpr";
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
}
// change header profile picture
// window['header'](this.profile);
}
async openAddEvent() {
@@ -1359,6 +1312,7 @@ export class AgendaPage implements OnInit {
} else {
this.timelineFilterState = segments
}
this.showTimelineFilterState = false;
}
}
@@ -177,6 +177,17 @@
</div>
</div>
<div class="middle-content">
<div *ngIf="postEvent.Body.Text">
<h5>Detalhes</h5>
<ion-item lines="none" class="ion-no-margin ion-no-padding">
<ion-textarea [(ngModel)]="postEvent.Body.Text" placeholder="Detalhes" ></ion-textarea>
</ion-item>
<div class="line"></div>
</div>
</div>
<div class="d-flex container-div width-100 ion-item-container-no-border" >
<ion-label (click)="getDoc()" class="cursor-pointer">
<div class="attach-icon">
@@ -241,72 +241,4 @@ export class EditEventPage 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)
}
}
@@ -9,6 +9,6 @@
<button class="btn-ok" shape="round" (click)="approveTask()">Aprovar</button>
<div class="solid"></div>
<button class="btn-cancel" shape="round" (click)="editTask()">Editar</button>
<button class="btn-delete" shape="round" (click)="deleteTask()">Rejeitar</button>
<button class="btn-delete" shape="round" (click)="rejeitar()">Rejeitar</button>
</div>
</ion-content>
@@ -35,44 +35,53 @@ export class EventActionsPopoverPage implements OnInit {
}
};
}
goBack(){
this.closePopover();
this.router.navigate(['/home/gabinete-digital/event-list']);
}
closePopover(){
this.popoverController.dismiss();
}
approveTask() {
let body = { "serialNumber": this.serialNumber, "action": "Aprovar" }
console.log(body);
try {
this.processes.PostTaskAction(body).toPromise()
this.router.navigate(['/home/gabinete-digital/event-list']);
this.modalController.dismiss(null);
this.toastService.successMessage()
this.toastService.successMessage();
this.goBack();
} catch (error) {
this.toastService.badRequest()
}
}
emendarTask() {
let body = { "serialNumber": this.serialNumber, "action": "Rejeitar" }
console.log(body);
try {
this.processes.PostTaskAction(body).toPromise()
this.router.navigate(['/home/gabinete-digital/event-list']);
this.modalController.dismiss(null);
this.toastService.successMessage()
this.processes.PostTaskAction(body).toPromise();
this.toastService.successMessage();
this.goBack();
} catch (error) {
this.toastService.badRequest()
}
}
deleteTask(){
async rejeitar(){
let body = { "serialNumber": this.serialNumber, "action": "Rejeitar" }
console.log(body);
try {
this.processes.PostTaskAction(body).toPromise();
await this.toastService.successMessage('Processo rejeitado');
this.goBack();
} catch (error) {
this.toastService.badRequest()
}
}
async editTask() {
console.log(this.serialNumber);
console.log(this.instanceId);
@@ -93,73 +102,4 @@ export class EventActionsPopoverPage 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)
}
}
@@ -13,7 +13,7 @@ import { NewEventPage } from './new-event.page';
CommonModule,
FormsModule,
IonicModule,
NewEventPageRoutingModule
NewEventPageRoutingModule,
],
declarations: [NewEventPage]
})
@@ -12,6 +12,8 @@
<ion-content>
<div class="main-content">
<!-- <input type="text" ngbDatepicker #d="ngbDatepicker"/> -->
<div class="ion-item-container">
<ion-input placeholder="Assunto" [(ngModel)]="postEvent.Subject"></ion-input>
</div>
@@ -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({