This commit is contained in:
tiago.kayaya
2021-07-29 15:27:12 +01:00
parent 58a823ac46
commit ae2319bbf3
5 changed files with 193 additions and 174 deletions
+107 -105
View File
@@ -41,7 +41,7 @@ import { CalendarService } from 'src/app/store/calendar.service';
], ],
}) })
export class AgendaPage implements OnInit { export class AgendaPage implements OnInit {
view: CalendarView = CalendarView.Day; view: CalendarView = CalendarView.Day;
viewDate: Date = new Date(); viewDate: Date = new Date();
@@ -73,16 +73,16 @@ export class AgendaPage implements OnInit {
showTimelinePR = false; showTimelinePR = false;
showTimelineMD = false; showTimelineMD = false;
// timeline filter // timeline filter
timelineFilterState: string = 'Todos'; timelineFilterState: string = 'Todos';
showTimelineFilterState: boolean; showTimelineFilterState: boolean;
showTimeline=true; showTimeline=true;
/* List of events of our calendar */ /* List of events of our calendar */
eventSource : eventSource[] = [] eventSource : eventSource[] = []
/* The title of the calendar */ /* The title of the calendar */
viewTitle: string; viewTitle: string;
@@ -108,12 +108,12 @@ export class AgendaPage implements OnInit {
taskParticipants: any = []; taskParticipants: any = [];
taskParticipantsCc: any = []; taskParticipantsCc: any = [];
adding: "intervenient" | "CC" = "intervenient"; adding: "intervenient" | "CC" = "intervenient";
@ViewChild(CalendarComponent) myCal: CalendarComponent; @ViewChild(CalendarComponent) myCal: CalendarComponent;
segment: "Combinado" | "Pessoal" | "Oficial" = "Combinado"; segment: "Combinado" | "Pessoal" | "Oficial" = "Combinado";
timelineSedment : "Combinado" | "Pessoal" | "Oficial"; timelineSedment : "Combinado" | "Pessoal" | "Oficial";
profile:'mdgpr' | 'pr'; profile:'mdgpr' | 'pr';
// this will make toggle add event and. // this will make toggle add event and.
@@ -153,7 +153,7 @@ export class AgendaPage implements OnInit {
IsEvent: "edit" | "add" | "view"; IsEvent: "edit" | "add" | "view";
viewingEventObject: CalendarEvent ; viewingEventObject: CalendarEvent ;
loggeduser: User; loggeduser: User;
constructor( constructor(
private alertCtrl: AlertController, private alertCtrl: AlertController,
@Inject(LOCALE_ID) private locale: string, @Inject(LOCALE_ID) private locale: string,
@@ -194,7 +194,7 @@ export class AgendaPage implements OnInit {
this.updateEventListBox() this.updateEventListBox()
}, 1000) }, 1000)
} }
ngOnInit() { ngOnInit() {
@@ -215,7 +215,7 @@ export class AgendaPage implements OnInit {
if ( realoadCounter != 0) { if ( realoadCounter != 0) {
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate); this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
} }
realoadCounter++; realoadCounter++;
} }
@@ -258,7 +258,7 @@ export class AgendaPage implements OnInit {
this.clearPostEvent(); this.clearPostEvent();
this.IsEvent= "view"; this.IsEvent= "view";
this.viewingEventObject = event; this.viewingEventObject = event;
this.eventSelectedDate = event.start; this.eventSelectedDate = event.start;
@@ -266,7 +266,7 @@ export class AgendaPage implements OnInit {
this.cloneAllmobileComponent(); this.cloneAllmobileComponent();
this.showEventEditOrOpen = 'edit'; this.showEventEditOrOpen = 'edit';
if( window.innerWidth <= 1024) { if( window.innerWidth <= 1024) {
@@ -289,7 +289,7 @@ export class AgendaPage implements OnInit {
onCurrentChanged = (ev: Date) => { onCurrentChanged = (ev: Date) => {
// timeline change date // timeline change date
this.timelineDate = momentG(new Date(ev),'dd MMMM yyyy'); this.timelineDate = momentG(new Date(ev),'dd MMMM yyyy');
this.viewDate = new Date(ev); this.viewDate = new Date(ev);
// calendar change date // calendar change date
this.eventSelectedDate = new Date(ev); this.eventSelectedDate = new Date(ev);
@@ -313,7 +313,7 @@ export class AgendaPage implements OnInit {
this.rangeEndDate = ev.endTime; this.rangeEndDate = ev.endTime;
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate); this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
try { try {
this.myCal.update(); this.myCal.update();
@@ -326,19 +326,19 @@ export class AgendaPage implements OnInit {
// for calendar // for calendar
currentDayEventDisplayBorder(day: any, id: any) { currentDayEventDisplayBorder(day: any, id: any) {
const events = day[id].events; const events = day[id].events;
if (events.length == 0) { if (events.length == 0) {
return ""; return "";
} else if (events.length >= 1) { } else if (events.length >= 1) {
let classs = []; let classs = [];
events.forEach(element => { events.forEach(element => {
const profile_ = element.profile == 'md'? 'mdgpr': 'pr'; const profile_ = element.profile == 'md'? 'mdgpr': 'pr';
const eventtype = element.event.CalendarName; const eventtype = element.event.CalendarName;
@@ -347,11 +347,11 @@ export class AgendaPage implements OnInit {
// // console.log(id, (endMinutes + endHours)) // // console.log(id, (endMinutes + endHours))
// classs.push(`calendar-event-border`); // classs.push(`calendar-event-border`);
// } // }
classs.push(`calendar-event-border calendar-${profile_}-event-type-${eventtype}`); classs.push(`calendar-event-border calendar-${profile_}-event-type-${eventtype}`);
}); });
return classs.join(' '); return classs.join(' ');
} }
@@ -389,7 +389,7 @@ export class AgendaPage implements OnInit {
this.showTimelineFilterState = false; this.showTimelineFilterState = false;
eventsList.forEach((element, eventIndex) => { eventsList.forEach((element, eventIndex) => {
// timeline start // timeline start
const startHours = new Date(element.StartDate).getHours().toLocaleString(); const startHours = new Date(element.StartDate).getHours().toLocaleString();
const EndHours = new Date(element.EndDate).getHours().toLocaleString(); const EndHours = new Date(element.EndDate).getHours().toLocaleString();
@@ -413,7 +413,7 @@ export class AgendaPage implements OnInit {
return events; return events;
} }
eventFilter() {} eventFilter() {}
TimelineDayEvent(day): string { TimelineDayEvent(day): string {
@@ -421,7 +421,7 @@ export class AgendaPage implements OnInit {
} }
get calendarDay(): string { get calendarDay(): string {
return ((new Date(this.timelineDate)).getDate()).toString().padStart(2,'0') return ((new Date(this.timelineDate)).getDate()).toString().padStart(2,'0')
} }
@@ -431,7 +431,7 @@ export class AgendaPage implements OnInit {
const endTimeSamp = new Date(endTime).toLocaleDateString() const endTimeSamp = new Date(endTime).toLocaleDateString()
const endMinutes = new Date(endTime).getMinutes() const endMinutes = new Date(endTime).getMinutes()
const endHours = new Date(endTime).getHours() const endHours = new Date(endTime).getHours()
if (startTimeSamp < endTimeSamp && (endMinutes + endHours) == 0) { if (startTimeSamp < endTimeSamp && (endMinutes + endHours) == 0) {
@@ -449,7 +449,7 @@ export class AgendaPage implements OnInit {
this.showLoader = true; this.showLoader = true;
if(window.innerWidth < 800){ if(window.innerWidth < 800){
// this.showTimeline = false; // this.showTimeline = false;
switch (this.segment) { switch (this.segment) {
@@ -458,27 +458,29 @@ export class AgendaPage implements OnInit {
if(this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR' ) { if(this.profile == "mdgpr" && 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( 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) => { (response:any) => {
console.log(response);
// calendar // calendar
this.calendarService.removeRange(startTime, endTime, 'md') this.calendarService.removeRange(startTime, endTime, 'md')
// loop // loop
this.calendarService.pushEvent(response, 'md'); this.calendarService.pushEvent(response, 'md');
this.TimelineMDList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, 'date') this.TimelineMDList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, 'date')
this.myCal.update(); this.myCal.update();
this.myCal.loadEvents(); this.myCal.loadEvents();
this.showLoader = false; this.showLoader = false;
this.showTimeline = true; this.showTimeline = true;
}).finally(()=>{ }).finally(()=>{
this.showLoader = false; this.showLoader = false;
}) })
} }
else if(this.profile == "pr" && this.loggeduser.Profile == 'MDGPR') { else if(this.profile == "pr" && this.loggeduser.Profile == 'MDGPR') {
@@ -487,7 +489,7 @@ export class AgendaPage implements OnInit {
this.calendarService.removeRange(startTime, endTime, 'pr') this.calendarService.removeRange(startTime, endTime, 'pr')
// calendar // calendar
this.calendarService.pushEvent(response, 'pr'); this.calendarService.pushEvent(response, 'pr');
this.TimelineMDList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') this.TimelineMDList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date')
this.myCal.update(); this.myCal.update();
@@ -495,31 +497,31 @@ export class AgendaPage implements OnInit {
this.showLoader = false; this.showLoader = false;
this.showTimeline = true; this.showTimeline = true;
}).finally(()=>{ }).finally(()=>{
this.showLoader = false; this.showLoader = false;
}) })
} }
else if(this.loggeduser.Profile == 'PR') { else if(this.loggeduser.Profile == '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( 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) => { (response:any) => {
// calendar // calendar
// this.eventSource=[]; // this.eventSource=[];
// clear the current month only // clear the current month only
this.calendarService.removeRange(startTime, endTime, 'pr') this.calendarService.removeRange(startTime, endTime, 'pr')
this.calendarService.pushEvent(response, 'pr'); this.calendarService.pushEvent(response, 'pr');
this.TimelineMDList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') this.TimelineMDList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date')
this.myCal.update(); this.myCal.update();
this.myCal.loadEvents(); this.myCal.loadEvents();
this.showLoader = false; this.showLoader = false;
this.showTimeline = true; this.showTimeline = true;
@@ -529,21 +531,21 @@ export class AgendaPage implements OnInit {
}) })
} }
break; break;
case "Pessoal": case "Pessoal":
//Inicializa o array eventSource //Inicializa o array eventSource
if(this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR') { 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')).then((response:any) => { this.eventService.getAllMdPessoalEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).then((response:any) => {
this.calendarService.removeRange(startTime, endTime, 'md') this.calendarService.removeRange(startTime, endTime, 'md')
const eventsList = response.filter(data => data.CalendarName == "Pessoal"); const eventsList = response.filter(data => data.CalendarName == "Pessoal");
// loop // loop
this.calendarService.pushEvent(eventsList, 'md'); this.calendarService.pushEvent(eventsList, 'md');
this.TimelineMDList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, 'date') this.TimelineMDList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, 'date')
this.myCal.update(); this.myCal.update();
this.myCal.loadEvents(); this.myCal.loadEvents();
@@ -552,22 +554,22 @@ export class AgendaPage implements OnInit {
}).finally(()=>{ }).finally(()=>{
this.showLoader = false; this.showLoader = false;
}) })
} }
else{ 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) => { 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.eventSource=[];
// clear the current month only // clear the current month only
this.calendarService.removeRange(startTime, endTime, 'pr') this.calendarService.removeRange(startTime, endTime, 'pr')
const eventsList = response.filter(data => data.CalendarName == "Pessoal"); const eventsList = response.filter(data => data.CalendarName == "Pessoal");
this.calendarService.pushEvent(eventsList, 'pr'); this.calendarService.pushEvent(eventsList, 'pr');
this.TimelineMDList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') this.TimelineMDList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date')
this.myCal.update(); this.myCal.update();
this.myCal.loadEvents(); this.myCal.loadEvents();
@@ -579,7 +581,7 @@ export class AgendaPage implements OnInit {
}) })
} }
break; break;
case "Oficial": case "Oficial":
//Inicializa o array eventSource //Inicializa o array eventSource
@@ -587,37 +589,37 @@ export class AgendaPage implements OnInit {
if(this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR') { if(this.profile == "mdgpr" && 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((res:any) => { 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.calendarService.removeRange(startTime, endTime, 'md') this.calendarService.removeRange(startTime, endTime, 'md')
const eventsList = res.filter(data => data.CalendarName == "Oficial"); const eventsList = res.filter(data => data.CalendarName == "Oficial");
this.calendarService.pushEvent(eventsList, 'md'); this.calendarService.pushEvent(eventsList, 'md');
this.TimelineMDList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, 'date') this.TimelineMDList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, 'date')
this.myCal.update(); this.myCal.update();
this.myCal.loadEvents(); this.myCal.loadEvents();
this.showLoader = false; this.showLoader = false;
this.showTimeline = true; this.showTimeline = true;
}).finally(()=>{ }).finally(()=>{
this.showLoader = false; this.showLoader = false;
}) })
} else { } 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((res:any) => { 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.eventSource=[];
this.calendarService.removeRange(startTime, endTime, 'pr') this.calendarService.removeRange(startTime, endTime, 'pr')
const eventsList = res.filter(data => data.CalendarName == "Oficial"); const eventsList = res.filter(data => data.CalendarName == "Oficial");
this.calendarService.pushEvent(eventsList, 'pr'); this.calendarService.pushEvent(eventsList, 'pr');
this.TimelineMDList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') this.TimelineMDList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date')
this.myCal.update(); this.myCal.update();
@@ -631,24 +633,24 @@ export class AgendaPage implements OnInit {
}) })
} }
break; break;
} }
} else { } else {
// calendar // calendar
let counter = 0; let counter = 0;
if(this.loggeduser.Profile == 'MDGPR') { 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) => { 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) => {
let eventsList = response; let eventsList = response;
this.calendarService.removeRange(startTime, endTime, 'md') this.calendarService.removeRange(startTime, endTime, 'md')
// loop // loop
this.calendarService.pushEvent(eventsList, 'md'); this.calendarService.pushEvent(eventsList, 'md');
this.TimelineMDList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, 'date') this.TimelineMDList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, 'date')
this.myCal.update(); this.myCal.update();
@@ -660,7 +662,7 @@ export class AgendaPage implements OnInit {
if(counter==2) { if(counter==2) {
this.showLoader = false; this.showLoader = false;
} }
}).finally(()=> { }).finally(()=> {
counter++; counter++;
@@ -670,21 +672,21 @@ export class AgendaPage implements OnInit {
}) })
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) => { 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) => {
let eventsList = response; let eventsList = response;
// clear the current month only // clear the current month only
this.calendarService.removeRange(startTime, endTime, 'pr') this.calendarService.removeRange(startTime, endTime, 'pr')
this.calendarService.pushEvent(eventsList, 'pr'); this.calendarService.pushEvent(eventsList, 'pr');
this.TimelinePRList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') this.TimelinePRList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date')
this.myCal.update(); this.myCal.update();
this.myCal.loadEvents(); this.myCal.loadEvents();
this.showTimelinePR = true; this.showTimelinePR = true;
counter++; counter++;
if(counter==2 || this.loggeduser.Profile == 'PR') { if(counter==2 || this.loggeduser.Profile == 'PR') {
@@ -701,7 +703,7 @@ export class AgendaPage implements OnInit {
} else { } 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) => { 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) => {
let eventsList; let eventsList;
if(this.segment == 'Oficial') { if(this.segment == 'Oficial') {
eventsList = response.filter(data => data.CalendarName == "Oficial"); eventsList = response.filter(data => data.CalendarName == "Oficial");
@@ -710,20 +712,20 @@ export class AgendaPage implements OnInit {
} else { } else {
eventsList = response; eventsList = response;
} }
// clear the current month only // clear the current month only
this.calendarService.removeRange(startTime, endTime, 'pr') this.calendarService.removeRange(startTime, endTime, 'pr')
this.calendarService.pushEvent(eventsList, 'pr'); this.calendarService.pushEvent(eventsList, 'pr');
this.TimelinePRList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date') this.TimelinePRList = this.eventListBoxComponent.list(this.calendarService.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, 'date')
this.myCal.update(); this.myCal.update();
this.myCal.loadEvents(); this.myCal.loadEvents();
this.showTimelinePR = true; this.showTimelinePR = true;
counter++; counter++;
if(counter==1 || this.loggeduser.Profile == 'PR') { if(counter==1 || this.loggeduser.Profile == 'PR') {
@@ -737,7 +739,7 @@ export class AgendaPage implements OnInit {
}) })
} }
} }
} }
@@ -756,34 +758,34 @@ export class AgendaPage implements OnInit {
var startDate: any = new Date(event.start); var startDate: any = new Date(event.start);
var endDate: any = this.EventTretment({ var endDate: any = this.EventTretment({
startTime: startDate, startTime: startDate,
endTime: event.end endTime: event.end
}) })
const day = (((new Date (event.start)).getDate())).toString().padStart(2,'0') const day = (((new Date (event.start)).getDate())).toString().padStart(2,'0')
event.manyDays = false event.manyDays = false
event.todayOnly = new Date(event.start).toLocaleDateString() == new Date(event.end).toLocaleDateString() event.todayOnly = new Date(event.start).toLocaleDateString() == new Date(event.end).toLocaleDateString()
if(!days.hasOwnProperty(day)) { if(!days.hasOwnProperty(day)) {
days[day] = [] days[day] = []
} }
if (new Date(startDate).toLocaleDateString() != new Date(endDate).toLocaleDateString()) { if (new Date(startDate).toLocaleDateString() != new Date(endDate).toLocaleDateString()) {
// difference // difference
const diffTime = Math.abs(endDate - startDate); const diffTime = Math.abs(endDate - startDate);
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)); const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
if (diffDays <= 150 && !event.event.IsAllDayEvent ) { if (diffDays <= 150 && !event.event.IsAllDayEvent ) {
if (diffDays >= 1) { if (diffDays >= 1) {
const StartEvent = Object.assign({}, { const StartEvent = Object.assign({}, {
title: event.title, title: event.title,
start: event.start, start: event.start,
@@ -805,28 +807,28 @@ export class AgendaPage implements OnInit {
endMany: false, endMany: false,
middle: false middle: false
}) })
days[day].push(StartEvent) days[day].push(StartEvent)
let i = 1; let i = 1;
while (startDate.getFullYear() != endDate.getFullYear() || while (startDate.getFullYear() != endDate.getFullYear() ||
startDate.getMonth() != endDate.getMonth() || startDate.getMonth() != endDate.getMonth() ||
startDate.getDate() != endDate.getDate()) { 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') let otherDays = (((new Date (newDate)).getDate())).toString().padStart(2,'0')
event.other = true event.other = true
event.start = newDate event.start = newDate
if(!days.hasOwnProperty(otherDays)) { if(!days.hasOwnProperty(otherDays)) {
days[otherDays] = [] days[otherDays] = []
} }
if (!(startDate.getFullYear() != endDate.getFullYear() || if (!(startDate.getFullYear() != endDate.getFullYear() ||
startDate.getMonth() != endDate.getMonth() || startDate.getMonth() != endDate.getMonth() ||
startDate.getDate() != endDate.getDate())) { startDate.getDate() != endDate.getDate())) {
// last push // last push
@@ -881,7 +883,7 @@ export class AgendaPage implements OnInit {
}) })
days[otherDays].push(EndEvent) days[otherDays].push(EndEvent)
} }
} }
} else { } else {
@@ -893,7 +895,7 @@ export class AgendaPage implements OnInit {
} }
} }
days[day].push(event) days[day].push(event)
@@ -908,7 +910,7 @@ export class AgendaPage implements OnInit {
} }
}) })
}, 10) }, 10)
return days return days
} }
@@ -955,7 +957,7 @@ export class AgendaPage implements OnInit {
} }
async openAddEvent() { async openAddEvent() {
await this.cloneAllmobileComponent(); await this.cloneAllmobileComponent();
this.showEventEditOrOpen = 'add'; this.showEventEditOrOpen = 'add';
@@ -975,7 +977,7 @@ export class AgendaPage implements OnInit {
await modal.present(); await modal.present();
modal.onDidDismiss().then((data) => { modal.onDidDismiss().then((data) => {
if(data){ if(data){
} }
this.openAddEventDismiss(data['data']) this.openAddEventDismiss(data['data'])
}); });
@@ -1015,7 +1017,7 @@ export class AgendaPage implements OnInit {
this.router.navigate(['/home/agenda', eventId, 'agenda']); this.router.navigate(['/home/agenda', eventId, 'agenda']);
/* console.log(this.profile); /* console.log(this.profile);
const modal = await this.modalCtrl.create({ const modal = await this.modalCtrl.create({
component: ViewEventPage, component: ViewEventPage,
componentProps:{ componentProps:{
@@ -1035,11 +1037,11 @@ export class AgendaPage implements OnInit {
// open component // open component
async viewEventDetailDismiss(data) { async viewEventDetailDismiss(data) {
await this.cloneAllmobileComponent() await this.cloneAllmobileComponent()
if (data.type == 'edit') { if (data.type == 'edit') {
this.selectedEvent = data.event; this.selectedEvent = data.event;
this.postEvent = data.event; this.postEvent = data.event;
@@ -1079,7 +1081,7 @@ export class AgendaPage implements OnInit {
approveEventDismiss({saveData, serialNumber, action}) { approveEventDismiss({saveData, serialNumber, action}) {
window['temp.path:/shared/agenda/edit-event-to-approve.ts'] = {} window['temp.path:/shared/agenda/edit-event-to-approve.ts'] = {}
if(action == 'Aprovar') { if(action == 'Aprovar') {
this.eventToaprove = { this.eventToaprove = {
back: true, back: true,
@@ -1111,7 +1113,7 @@ export class AgendaPage implements OnInit {
} }
} }
closeEventToApproveGoBack() { closeEventToApproveGoBack() {
if( window.innerWidth <= 801){ if( window.innerWidth <= 801){
this.router.navigate(['/home/agenda/event-list']); this.router.navigate(['/home/agenda/event-list']);
@@ -1154,7 +1156,7 @@ export class AgendaPage implements OnInit {
async openAttendeesComponent(data) { async openAttendeesComponent(data) {
this.adding = data.type this.adding = data.type
this.cloneAllmobileComponent(); this.cloneAllmobileComponent();
this.mobileComponent.showAttendees = true; this.mobileComponent.showAttendees = true;
} }
@@ -1174,7 +1176,7 @@ export class AgendaPage implements OnInit {
async GoBackEditOrAdd() { async GoBackEditOrAdd() {
if(this.showEventEditOrOpen == "edit") { if(this.showEventEditOrOpen == "edit") {
this.cloneAllmobileComponent(); this.cloneAllmobileComponent();
@@ -1210,7 +1212,7 @@ export class AgendaPage implements OnInit {
this.taskParticipants = removeDuplicate(data) this.taskParticipants = removeDuplicate(data)
} }
async setIntervenientCC(data) { async setIntervenientCC(data) {
this.taskParticipantsCc = removeDuplicate(data) this.taskParticipantsCc = removeDuplicate(data)
} }
@@ -1255,11 +1257,11 @@ export class AgendaPage implements OnInit {
} }
}) })
}, 100) }, 100)
} }
async showEventBox(event) { async showEventBox(event) {
if ( event.event.CalendarName == this.segment || this.segment == 'Combinado') { if ( event.event.CalendarName == this.segment || this.segment == 'Combinado') {
return true return true
} }
@@ -1279,4 +1281,4 @@ export class AgendaPage implements OnInit {
return reuslt.length != 0 return reuslt.length != 0
} }
} }
-1
View File
@@ -295,7 +295,6 @@ export class EventsPage implements OnInit {
case 'MDGPR': case 'MDGPR':
this.processes.GetTasksList("Expediente", false).subscribe(result => { this.processes.GetTasksList("Expediente", false).subscribe(result => {
console.log(result); console.log(result);
this.expedienteStorage.reset(result) this.expedienteStorage.reset(result)
}); });
break; break;
@@ -1,77 +1,84 @@
<ion-header class="ion-no-border"> <ion-header class="ion-no-border">
<app-header></app-header> <app-header></app-header>
</ion-header> </ion-header>
<ion-header class="ion-no-border header-2">
<div class="header-content">
<div class="header-icon-left">
<button class="btn-no-color cursor-pointer" (click)="goBack()">
<ion-icon src="assets/images/icons-arrow-arrow-left.svg"></ion-icon>
</button>
</div>
<div class="header-title">
<label>Eventos para Aprovação</label>
</div>
<ion-toolbar>
<ion-segment [(ngModel)]="segment" (ionChange)="segmentChanged($event)">
<ion-segment-button value="MDGPR">
Meu calendário
</ion-segment-button>
<ion-segment-button value="PR">
Presidente da República
</ion-segment-button>
</ion-segment>
</ion-toolbar>
</div>
</ion-header>
<ion-content> <ion-content>
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh()"> <ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar> <ion-progress-bar type="indeterminate" *ngIf="skeletonLoader"></ion-progress-bar>
<ion-refresher-content> <ion-refresher-content>
</ion-refresher-content> </ion-refresher-content>
</ion-refresher> </ion-refresher>
<div class="main-content d-flex height-100" [ngSwitch]="segment"> <div class="main-content d-flex height-100" >
<div class="content d-flex flex-column">
<div class="header-content">
<div class="header-icon-left">
<button class="btn-no-color cursor-pointer" (click)="goBack()">
<ion-icon src="assets/images/icons-arrow-arrow-left.svg"></ion-icon>
</button>
</div>
<div class="header-title">
<label>Eventos para Aprovação</label>
</div>
<ion-toolbar>
<ion-segment [(ngModel)]="segment" (ionChange)="segmentChanged($event)">
<ion-segment-button value="MDGPR">
Meu calendário
</ion-segment-button>
<ion-segment-button value="PR">
Presidente da República
</ion-segment-button>
</ion-segment>
</ion-toolbar>
<ion-progress-bar type="indeterminate" *ngIf="skeletonLoader"></ion-progress-bar>
</div>
<ion-list *ngSwitchCase="'MDGPR'"> <div class="content d-flex flex-column">
<div *ngIf="eventaprovacaostore.listmd" class="overflow-y-auto height-100"> <div [ngSwitch]="segment">
<ion-list *ngSwitchCase="'MDGPR'">
<div *ngIf="eventaprovacaostore.listmd" class="overflow-y-auto height-100">
<ion-item-sliding>
<ion-item class="Rectangle cursor-pointer" lines="none"
*ngFor="let event of eventaprovacaostore.listmd" (click)="goToEventToApproveDetail(event.serialNumber)">
<div class="content-mdgpr-{{event.workflowInstanceDataFields.Agenda}} width-100">
<div class="approve-event-time">
<p>{{event.workflowInstanceDataFields.StartDate | date: 'HH:mm'}}</p>
<p>{{event.workflowInstanceDataFields.EndDate | date: 'HH:mm'}}</p>
</div>
<div class="approve-event-detail">
<p *ngIf="event.workflowInstanceDataFields.StartDate != event.workflowInstanceDataFields.EndDate">{{event.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} - {{ event.workflowInstanceDataFields.EndDate | date: 'dd/M/yy'}} | {{event.workflowInstanceDataFields.Location}}</p>
<p *ngIf="event.workflowInstanceDataFields.StartDate == event.workflowInstanceDataFields.EndDate">{{event.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} | {{event.workflowInstanceDataFields.Location}}</p>
<h3>{{event.workflowInstanceDataFields.Subject}}</h3>
</div>
</div>
</ion-item>
</ion-item-sliding>
</div>
</ion-list>
<ion-list *ngSwitchCase="'PR'">
<div *ngIf="eventaprovacaostore.listpr" class="overflow-y-auto height-100">
<ion-item-sliding> <ion-item-sliding>
<ion-item class="Rectangle cursor-pointer" lines="none" <ion-item class="Rectangle cursor-pointer" lines="none"
*ngFor="let event of eventaprovacaostore.listmd" (click)="goToEventToApproveDetail(event.serialNumber)"> *ngFor="let event of eventaprovacaostore.listpr" (click)="goToEventToApproveDetail(event.serialNumber)">
<div class="content-pr-{{event.workflowInstanceDataFields.Agenda}} width-100">
<div class="content-mdgpr-{{event.workflowInstanceDataFields.Agenda}} width-100"> <div class="approve-event-time">
<div class="approve-event-time"> <p>{{event.workflowInstanceDataFields.StartDate | date: 'HH:mm'}}</p>
<p>{{event.workflowInstanceDataFields.StartDate | date: 'HH:mm'}}</p> <p>{{event.workflowInstanceDataFields.EndDate | date: 'HH:mm'}}</p>
<p>{{event.workflowInstanceDataFields.EndDate | date: 'HH:mm'}}</p> </div>
<div class="approve-event-detail">
<p *ngIf="event.workflowInstanceDataFields.StartDate != event.workflowInstanceDataFields.EndDate">{{event.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} - {{ event.workflowInstanceDataFields.EndDate | date: 'dd/M/yy'}} | {{event.workflowInstanceDataFields.Location}}</p>
<p *ngIf="event.workflowInstanceDataFields.StartDate == event.workflowInstanceDataFields.EndDate">{{event.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} | {{event.workflowInstanceDataFields.Location}}</p>
<h3>{{event.workflowInstanceDataFields.Subject}}</h3>
</div>
</div> </div>
<div class="approve-event-detail"> </ion-item>
<p *ngIf="event.workflowInstanceDataFields.StartDate != event.workflowInstanceDataFields.EndDate">{{event.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} - {{ event.workflowInstanceDataFields.EndDate | date: 'dd/M/yy'}} | {{event.workflowInstanceDataFields.Location}}</p>
<p *ngIf="event.workflowInstanceDataFields.StartDate == event.workflowInstanceDataFields.EndDate">{{event.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} | {{event.workflowInstanceDataFields.Location}}</p>
<h3>{{event.workflowInstanceDataFields.Subject}}</h3>
</div>
</div>
</ion-item>
</ion-item-sliding> </ion-item-sliding>
</div> </div>
</ion-list> </ion-list>
<ion-list *ngSwitchCase="'PR'"> </div>
<div *ngIf="eventaprovacaostore.listpr" class="overflow-y-auto height-100">
<ion-item-sliding>
<ion-item class="Rectangle cursor-pointer" lines="none"
*ngFor="let event of eventaprovacaostore.listpr" (click)="goToEventToApproveDetail(event.serialNumber)">
<div class="content-pr-{{event.workflowInstanceDataFields.Agenda}} width-100">
<div class="approve-event-time">
<p>{{event.workflowInstanceDataFields.StartDate | date: 'HH:mm'}}</p>
<p>{{event.workflowInstanceDataFields.EndDate | date: 'HH:mm'}}</p>
</div>
<div class="approve-event-detail">
<p *ngIf="event.workflowInstanceDataFields.StartDate != event.workflowInstanceDataFields.EndDate">{{event.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} - {{ event.workflowInstanceDataFields.EndDate | date: 'dd/M/yy'}} | {{event.workflowInstanceDataFields.Location}}</p>
<p *ngIf="event.workflowInstanceDataFields.StartDate == event.workflowInstanceDataFields.EndDate">{{event.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} | {{event.workflowInstanceDataFields.Location}}</p>
<h3>{{event.workflowInstanceDataFields.Subject}}</h3>
</div>
</div>
</ion-item>
</ion-item-sliding>
</div>
</ion-list>
</div> </div>
</div> </div>
</ion-content> </ion-content>
@@ -1,11 +1,17 @@
@import '~src/function.scss'; @import '~src/function.scss';
.header-2 {
border-top-right-radius: 24px;
border-top-left-radius: 24px;
}
.header-2{
padding: 30px 20px 0 20px !important;
background-color: white;
}
.main-content{ .main-content{
background-color: #fff !important; background-color: #fff !important;
border-top-left-radius: 25px;
border-top-right-radius: 25px;
} }
.content{ .content{
padding: 30px 20px 0 20px !important; padding: 0px 20px 0 20px !important;
/* margin: 0 auto; */ /* margin: 0 auto; */
float: left; float: left;
overflow: auto; overflow: auto;
@@ -45,7 +45,7 @@ export class EventListPage implements OnInit {
this.router.events.forEach((event) => { this.router.events.forEach((event) => {
if (event instanceof NavigationStart && event.url.startsWith(pathname)) { if (event instanceof NavigationStart && event.url.startsWith(pathname)) {
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) { if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.doRefresh() this.refreshing()
} else { } else {
this.LoadToApproveEvents() this.LoadToApproveEvents()
} }
@@ -76,12 +76,16 @@ export class EventListPage implements OnInit {
let mdEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal MDGPR', false).toPromise(); let mdEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal MDGPR', false).toPromise();
this.eventsMDGPRList = mdEventsOficial.concat(mdEventsPessoal); this.eventsMDGPRList = mdEventsOficial.concat(mdEventsPessoal);
this.eventaprovacaostore.resetmd(this.eventsMDGPRList); this.eventaprovacaostore.resetmd(this.eventsMDGPRList);
console.log(this.eventsMDGPRList);
} }
else if(this.segment == 'PR'){ else if(this.segment == 'PR'){
let prEventsOficial = await this.processes.GetTasksList('Agenda Oficial PR', false).toPromise(); let prEventsOficial = await this.processes.GetTasksList('Agenda Oficial PR', false).toPromise();
let prEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal PR', false).toPromise(); let prEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal PR', false).toPromise();
this.eventsPRList = prEventsOficial.concat(prEventsPessoal); this.eventsPRList = prEventsOficial.concat(prEventsPessoal);
this.eventaprovacaostore.resetpr(this.eventsPRList); this.eventaprovacaostore.resetpr(this.eventsPRList);
console.log(this.eventsMDGPRList);
} }
this.showLoader = false; this.showLoader = false;
this.skeletonLoader = false this.skeletonLoader = false
@@ -124,10 +128,11 @@ export class EventListPage implements OnInit {
}, 1000); }, 1000);
} }
doRefresh() { doRefresh(event) {
setTimeout(() => { setTimeout(() => {
this.LoadToApproveEvents(); this.LoadToApproveEvents();
event.target.complete();
}, 1000); }, 1000);
} }