change agenda

This commit is contained in:
Peter Maquiran
2023-03-30 14:31:58 +01:00
parent 8deed4cf94
commit b7d878851e
13 changed files with 350 additions and 723 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ export interface Environment {
defaultuser: string;
defaultuserpwd: string;
chatOffline: boolean;
presidencial: boolean;
presidential: boolean;
version: version;
sentryUrl: string;
despachoLabel: string
+65 -161
View File
@@ -95,26 +95,51 @@
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " slot="icon-only" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-calendar-arrow-right.svg"></ion-icon>
</div>
<div style="
padding-bottom: 10px;
padding-left: 10px;
padding-right: 10px;
background: #f7f7f7;
border-radius: 5px;">
<mat-form-field appearance="none" color="ion-color-secondary" placeholder="Selecione agenda">
<mat-select [(value)]="CalendarName" (selectionChange)="reloadCalendar()">
<!-- <mat-option *ngFor="let calendars of _eventService.calendarNamesAry; let i = index" value="{{calendars}}">
<div *ngIf="calendars != 'Meu calendario' && calendars == 'Presidente da República'"> {{ environment.agendaPR}} </div>
<div *ngIf="calendars != 'Meu calendario' && calendars == 'Ministro e Director do Gabinete do PR'"> {{ environment.agendaVP}} </div>
<div *ngIf="calendars != 'Meu calendario' && calendars != 'Ministro e Director do Gabinete do PR' && calendars != 'Presidente da República'"> Agenda do {{calendars}} </div>
<div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div> -->
<mat-option *ngFor="let calendars of eventService.calendarNamesAry" value="{{calendars.Fullname || calendars}}">
<div *ngIf="environment.presidential">
<div *ngIf="calendars.Role == 'Presidente da República'"> PR </div>
<div *ngIf="calendars.Role == 'Ministro e Director do Gabinete do PR'"> MDGPR </div>
<div *ngIf="calendars.Role != 'Ministro e Director do Gabinete do PR' && calendars.Role != 'Presidente da República'"> Agenda do {{calendars.Fullname}} </div>
</div>
<div *ngIf="!environment.presidential">
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Presidente da República'"> {{ environment.agendaPR}} </div>
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Ministro e Director do Gabinete do PR'"> {{ environment.agendaVP}} </div>
<div *ngIf="calendars != 'Meu calendario' && calendars.Role != 'Ministro e Director do Gabinete do PR' && calendars.Role != 'Presidente da República'"> Agenda do {{calendars.Fullname}} </div>
<div *ngIf="calendars == 'Meu calendario'">Minha agenda</div>
</div>
</mat-option>
<mat-option value="PR+MDGPR" *ngIf="!environment.presidential && 99999873 == SessionStore.user.RoleID">
PR+MDGPR
</mat-option>
</mat-select>
</mat-form-field>
</div>
</ion-row>
<ion-row class="ion-align-items-center">
<mat-form-field appearance="none" class="width-100" color="ion-color-secondary" placeholder="Selecione agenda">
<mat-select [(value)]="CalendarName">
<!-- <mat-option *ngFor="let calendars of _eventService.calendarNamesAry; let i = index" value="{{calendars}}">
<div *ngIf="calendars != 'Meu calendario' && calendars == 'Presidente da República'"> {{ environment.agendaPR}} </div>
<div *ngIf="calendars != 'Meu calendario' && calendars == 'Ministro e Director do Gabinete do PR'"> {{ environment.agendaVP}} </div>
<div *ngIf="calendars != 'Meu calendario' && calendars != 'Ministro e Director do Gabinete do PR' && calendars != 'Presidente da República'"> Agenda do {{calendars}} </div>
<div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div> -->
<mat-option *ngFor="let calendars of eventService.calendarNamesAry" value="{{calendars.Fullname || calendars}}">
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Presidente da República'"> {{ environment.agendaPR}} </div>
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Ministro e Director do Gabinete do PR'"> {{ environment.agendaVP}} </div>
<div *ngIf="calendars != 'Meu calendario' && calendars.Role != 'Ministro e Director do Gabinete do PR' && calendars.Role != 'Presidente da República'"> Agenda do {{calendars.Fullname}} </div>
<div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div>
</mat-option>
</mat-select>
</mat-form-field>
<!-- <div class="calendar-letters cal-reverse" *ngIf="SessionStore.user.Profile != 'PR' && SessionStore.user.Profile != 'MDGPR' && eventService.hasSharedCalendar && eventService.hasOwnCalendar" class="calendar-letters" [class.cal-reverse]="profile == 'mdgpr' " (click)="changeProfile()">
<div class="text" *ngIf="profile == 'mdgpr'">
@@ -127,6 +152,7 @@
</div>
<button *ngIf="profile == 'mdgpr' && ( SessionStore.user.Profile == 'PR' || SessionStore.user.Profile == 'MDGPR') && eventService.hasSharedCalendar " (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>
@@ -134,6 +160,7 @@
<button title="Mudar de Agenda" *ngIf="profile == 'pr'&& ( SessionStore.user.Profile == 'PR' || SessionStore.user.Profile == 'MDGPR') && eventService.hasSharedCalendar" (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>
-->
<button title="Visualizar a lista de Eventos para aprovação" class="btn-no-color cursor-pointer resize" (click)="viewEventsToApprove()" *ngIf="p.userPermission([p.permissionList.Gabinete.aprove_event])">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="right-icons" src="assets/images/icons-received-event.svg"></ion-icon>
@@ -147,9 +174,11 @@
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && !mobileComponent.showAddNewEvent" class="right-icons" src="assets/images/theme/gov/icons-add.svg" ></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && mobileComponent.showAddNewEvent" class="right-icons" src="assets/images/theme/gov/icons-add-selected.svg" ></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " class="right-icons" slot="icon-only" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-add.svg"></ion-icon>
</button> -->
</button>
</ion-row>
</ion-row>
<table class="custom-calendar-header">
@@ -166,7 +195,7 @@
<calendar
class="calendar-component"
[eventSource]="CalendarStore.eventSource"
[eventSource]="listToPresent"
[calendarMode]="calendar.mode"
[currentDate]="calendar.currentDate"
(onEventSelected)="onEventSelected($event)"
@@ -202,58 +231,18 @@
<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">
<ion-row class="timeline-date align-center">
<button class="btn-no-color" *ngIf="showCalendar" (click)="calendarHeight='75px';showCalendar=false">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="collaps btn-no-color" src="assets/images/icons-collaps-up.svg" ></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="collaps btn-no-color" src="assets/images/theme/gov/icons-collaps-up.svg" ></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " class="collaps btn-no-color" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-collaps-up.svg"></ion-icon>
</button>
<button class="btn-no-color" *ngIf="!showCalendar" (click)="calendarHeight='356px';showCalendar=true">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="collaps btn-no-color" src="assets/images/icons-collaps-down.svg" ></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="collaps btn-no-color" src="assets/images/theme/gov/icons-collaps-down.svg" ></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " class="collaps btn-no-color" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-collaps-down.svg" ></ion-icon>
</button >
</ion-row>
<ion-row class="timeline-date align-center">
<span *ngIf="timelineIsCurrentDate()">Hoje,&nbsp;</span> {{ timelineDate }}
</ion-row>
<ion-row class="filter ion-align-items-center" >
<div class="filter-name" (click)="showTimelineFilterState=!showTimelineFilterState">{{timelineFilterState}}</div>
<!-- Icon -->
<button class="arrow-down btn-no-color" (click)="showTimelineFilterState=!showTimelineFilterState">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " style="font-size: 19pt;" src="assets/images/icons-arrow-arrow-down.svg" ></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " style="font-size: 19pt;" src="assets/images/theme/gov/icons-arrow-arrow-down.svg" ></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " style="font-size: 19pt;" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-arrow-arrow-down.svg" ></ion-icon>
</button>
<!-- List -->
<ul *ngIf="showTimelineFilterState">
<li class="changeText" [class.active]="segment == 'Combinado' " (click)="changeSegment('Combinado')" class="cursor-pointer">Todos</li>
<li class="changeText" [class.active]="segment == 'Oficial' " (click)="changeSegment('Oficial')" class="cursor-pointer">Agenda Oficial</li>
<li class="changeText" [class.active]="segment == 'Pessoal' " (click)="changeSegment('Pessoal')" class="cursor-pointer">Agenda Pessoal</li>
</ul>
<div class="calendar-title-container px-20 d-md-flex">
</ion-row>
</ion-row>
<div class="calendar-title-container px-20 d-none d-md-flex">
<div class="calendar-title-description flex-grow-1 text-grey d-flex justify-center align-center" *ngIf="eventService.hasOwnCalendar">
<!-- <div >Agenda de {{SessionStore.user.FullName}}</div> -->
<div >Minha agenda</div>
<div style="padding-right: 75px" class=" text-black align-center cursor-pointer" (click)="changeSegment('Combinado')" [class.active]="segment == 'Combinado' ">
Todos
</div>
<div class="calendar-title-description text-black align-center" *ngIf="eventService.hasSharedCalendar">
<div class="flex-grow-1 text-grey d-flex justify-center align-center">
<mat-option *ngFor="let calendars of eventService.calendarNamesAry" value="{{calendars.Fullname || calendars}}">
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Presidente da República'"> {{ environment.agendaPR}} </div>
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Ministro e Director do Gabinete do PR'"> {{ environment.agendaVP}} </div>
<div *ngIf="calendars != 'Meu calendario' && calendars.Role != 'Ministro e Director do Gabinete do PR' && calendars.Role != 'Presidente da República'"> Agenda do {{calendars.Fullname}} </div>
</mat-option>
</div>
<div style="padding-right: 75px" class=" text-black align-center cursor-pointer" (click)="changeSegment('Pessoal')" [class.active]="segment == 'Pessoal' ">
Pessoais
</div>
<div class=" text-black align-center cursor-pointer" (click)="changeSegment('Oficial')" [class.active]="segment == 'Oficial' ">
Oficiais
</div>
</div>
@@ -262,16 +251,19 @@
</div>
<div class="timeline-wrapper flex-grow-1 height-100" >
<div class="height-100">
<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 pr-10 d-md-none text-black height-100 width-100 overflow-y-auto" >
<div *ngFor="let events of TimelineMDList | keyvalue;" >
<div class="ss-timeline timeline-mobile flex-grow-1 pr-10 text-black height-100 width-100 overflow-y-auto" >
<div class="timeline-date align-center" *ngIf="timelineIsCurrentDate()">
<span >Hoje,&nbsp;</span> {{ timelineDate }}
</div>
<div *ngFor="let events of TimelineMDList | keyvalue; " >
<div class="EventListBox-container" >
<div class="day mt-10" >
{{ TimelineDayEvent(events.key)}}
<div class="day mt-10 " [class.dayShow]="timelineIsCurrentDate()" >
{{ TimelineDay(events.key)}} <div style="text-transform: capitalize; display: inline;">{{ viewTitle }}</div>
</div>
<div *ngFor="let event of events.value" class="EventListBox" >
@@ -310,94 +302,6 @@
</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="SessionStore.user.OwnerCalendars.length && SessionStore.user.Profile != 'PR' ">
<div *ngFor="let events of TimelineMDList | keyvalue;" >
<div class="EventListBox-container" >
<div class="day EventListBox-day mt-10" >
{{ TimelineDayEvent(events.key) }}
</div>
<div *ngFor="let event of events.value" class="EventListBox" >
<div class="d-flex content-mdgpr-{{event.event.CalendarName}} mt-10 cursor-pointer item-hover" (click)="eventClicked(event)"
>
<div class="schedule-time" *ngIf="!event.event.IsAllDayEvent">
<div *ngIf="event.startMany && !event.middle" class="time-start labelb">Início</div>
<div *ngIf="event.endMany && !event.middle " class="time-end labelb">Fim</div>
<div *ngIf="!(event.endMany && !event.middle) && !event.middle" class="time-start">{{event.event.StartDate | date: 'HH:mm'}}</div>
<div *ngIf="!(event.startMany && !event.middle) && !event.middle" class="time-end">{{event.event.EndDate | date: 'HH:mm'}} </div>
<div *ngIf="event.middle" class="time-start"> Todo </div>
<div *ngIf="event.middle" class="time-end text-center"> o dia </div>
</div>
<div class="schedule-time" *ngIf="event.event.IsAllDayEvent">
<div class="time-start">Todo </div>
<div class="time-end">o dia</div>
</div>
<div class="schedule-details">
<div class="description">
<p class="m-0">{{event.event.Subject}}</p>
</div>
<div class="location">{{event.event.Location}}</div>
<div class="font-13 calendar-owner"*ngIf="eventService.getCalendarOwnNameByCalendarId(event.event.CalendarId) == 'Meu calendario'">{{SessionStore.user.FullName}} </div>
<ng-template #other_content>{{eventService.getCalendarOwnNameByCalendarId(event.event.CalendarId)}}</ng-template>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- shared desktop -->
<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" *ngIf="SessionStore.user.SharedCalendars.length != 0 || SessionStore.user.Profile == 'PR' " >
<div *ngFor="let events of TimelinePRList | keyvalue;">
<div class="EventListBox-container" >
<div class="day mt-10" >
{{ TimelineDayEvent(events.key)}}
</div>
<div *ngFor="let event of events.value" class="EventListBox" >
<div class="d-flex content-pr-{{event.event.CalendarName}} mt-10 cursor-pointer item-hover" (click)="eventClicked(event)">
<div class="schedule-time" *ngIf="!event.event.IsAllDayEvent">
<div *ngIf="event.startMany && !event.middle" class="time-start labelb">Início</div>
<div *ngIf="event.endMany && !event.middle " class="time-end labelb">Fim</div>
<div *ngIf="!(event.endMany && !event.middle) && !event.middle" class="time-start">{{event.event.StartDate | date: 'HH:mm'}}</div>
<div *ngIf="!(event.startMany && !event.middle) && !event.middle" class="time-end">{{event.event.EndDate | date: 'HH:mm'}} </div>
<div *ngIf="event.middle" class="time-start"> Todo </div>
<div *ngIf="event.middle" class="time-end text-center"> o dia </div>
</div>
<div class="schedule-time" *ngIf="event.event.IsAllDayEvent">
<div class="time-start">Todo </div>
<div class="time-end">o dia</div>
</div>
<div class="schedule-details">
<div class="description">
<p class="m-0">{{event.event.Subject}}</p>
</div>
<div class="location">{{event.event.Location}}</div>
<div class="font-13 calendar-owner"*ngIf="eventService.getCalendarOwnNameByCalendarId(event.event.CalendarId) == 'Meu calendario'"> {{SessionStore.user.FullName}} </div>
<ng-template #other_content>{{eventService.getCalendarOwnNameByCalendarId(event.event.CalendarId)}}</ng-template>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
+17 -23
View File
@@ -400,10 +400,6 @@ td.monthview-primary-with-event {
.currente-date-timelien{
cursor: pointer;
padding: 10px 20px;
.timeline-date{
font-size: 15px;
font-weight: bold;
}
.collaps{
font-size: 26px;
padding-right: 8px;
@@ -452,6 +448,11 @@ td.monthview-primary-with-event {
}
}
.timeline-date{
font-size: 13px;
font-weight: 500;
color: gray;
}
.showcalendar{
display: none;
@@ -467,8 +468,8 @@ td.monthview-primary-with-event {
.timeline-container{
.day {
font-weight: bold;
color: #2e2e2e !important;
font-weight: 500;
color: gray !important;
font-size: 13px;
}
.EventListBoxBorder{
@@ -482,6 +483,7 @@ td.monthview-primary-with-event {
}
.schedule-time{
margin-right: 10px;
min-width: 33px;
@@ -567,23 +569,6 @@ td.monthview-primary-with-event {
margin: 0 !important;
}
.content-pr-Pessoal{
background-color: var(--white);
border-radius: 5px;
border-right: 5px solid #958bfc;
overflow: auto;
}
.content-mdgpr-Oficial{
border-radius: 5px;
border-right: 5px solid #ffb703;
overflow: auto;
}
.content-mdgpr-Pessoal{
border-radius: 5px;
border-right: 5px solid #f05d5e;
overflow: auto;
}
}
@@ -924,4 +909,13 @@ $font-size: 11pt;
.labelb {
font-weight: 500;
}
.active{
font-weight: bold !important;
}
.ss-timeline > :nth-child(3) .dayShow {
display: none;
}
+199 -497
View File
@@ -33,6 +33,8 @@ import { ThemeService } from 'src/app/services/theme.service'
import { SessionStore } from 'src/app/store/session.service';
import { PermissionService } from 'src/app/services/permission.service';
import { environment } from 'src/environments/environment';
import { RoleIdService } from 'src/app/services/role-id.service'
import { EventListStore } from 'src/app/models/agenda/AgendaEventList';
@Component({
selector: 'app-agenda',
@@ -72,9 +74,8 @@ export class AgendaPage implements OnInit {
// for timeline
events: CalendarEvent[] = [];
TimelinePR: CalendarEvent[] = [];
TimelinePRList = {}
TimelineMD: CalendarEvent[] = [];
TimelineMDList = {}
TimelineMDList = {};
showTimelinePR = false;
showTimelineMD = false;
@@ -161,7 +162,7 @@ export class AgendaPage implements OnInit {
dropdownScrollWeal = false
CalendarStore = CalendarStore
listToPresent
listToPresent: EventListStore[] = []
array = []
SessionStore = SessionStore;
@@ -182,6 +183,7 @@ export class AgendaPage implements OnInit {
public ThemeService: ThemeService,
private storage:Storage,
public p: PermissionService,
public RoleIdService: RoleIdService
) {
this.dateAdapter.setLocale('es');
@@ -253,9 +255,13 @@ export class AgendaPage implements OnInit {
}, 1000)
}
ngOnInit() {
this.setCalendarByDefault()
const selectedCalendarIds = this.getSelectedAgendaCalendars();
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
setTimeout(() => {
const pathname = window.location.pathname
@@ -396,8 +402,6 @@ export class AgendaPage implements OnInit {
this.myCal.loadEvents();
} catch (e) { }
this.updateEventListBox()
}
// for calendar
@@ -487,6 +491,11 @@ export class AgendaPage implements OnInit {
return (day).padStart(2, '0') + ' ' + this.viewTitle
}
TimelineDay(day) {
return (day).padStart(2, '0')
}
get calendarDay(): string {
return ((new Date(this.timelineDate)).getDate()).toString().padStart(2, '0')
@@ -546,563 +555,251 @@ export class AgendaPage implements OnInit {
return false
}
this.array = [];
this.rangeStartDate = startTime
this.rangeEndDate = endTime
this.showLoader = true;
if (window.innerWidth < 800) {
const selectedCalendarIds = this.getSelectedAgendaCalendars();
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
this.updateEventListBox()
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(
try {
this.myCal.update();
this.myCal.loadEvents();
} catch (error) {
(response: any) => {
}
this.addEventToDB(response, "md");
let load = 0;
// calendar
this.CalendarStore.removeRange(startTime, endTime, 'md')
for ( const selectedCalendar of selectedCalendarIds) {
this.eventService.getEventsByCalendarId(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59'), selectedCalendar.calendarId).then((response: any) => {
// loop
this.CalendarStore.pushEvent(response, 'md');
let label;
this.trasnformData(response, 'md');
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
this.myCal.update();
this.myCal.loadEvents();
this.showLoader = false;
this.showTimeline = true;
}).catch((error) => {
console.error(error)
this.getFromDB();
}).finally(() => {
this.showLoader = false;
this.deleteLoadRangeEvent(startTime, endTime)
this.updateEventListBox()
})
}
// view PR calendar with MDGPR profile
else if (this.profile == "pr" && this.loggeduser.Profile == 'MDGPR') {
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.addEventToDB(response, "pr");
this.CalendarStore.removeRange(startTime, endTime, 'pr')
// calendar
this.CalendarStore.pushEvent(response, 'pr');
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
//
this.myCal.update();
this.myCal.loadEvents();
this.showLoader = false;
this.showTimeline = true;
}).catch((error) => {
this.getFromDB()
})
.finally(() => {
this.deleteLoadRangeEvent(startTime, endTime)
this.showLoader = false;
this.updateEventListBox()
})
}
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(
(response: any) => {
this.addEventToDB(response, "pr");
// clear the current month only
// response == september
// startTime = 1, endTime = 31
this.CalendarStore.removeRange(startTime, endTime, 'pr')
this.CalendarStore.pushEvent(response, 'pr');
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
//
this.myCal.update();
this.myCal.loadEvents();
this.showLoader = false;
this.showTimeline = true;
}).catch((error) => {
console.error(error)
this.getFromDB()
})
.finally(() => {
this.deleteLoadRangeEvent(startTime, endTime)
this.showLoader = false;
this.updateEventListBox()
})
} 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) => {
this.addEventToDB(response, "md");
// calendar
this.CalendarStore.removeRange(startTime, endTime, 'md')
// loop
this.CalendarStore.pushEvent(response, 'md');
this.trasnformData(response, 'md');
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
//
this.myCal.update();
this.myCal.loadEvents();
this.showLoader = false;
this.showTimeline = true;
}).catch((error) => {
console.error(error)
this.getFromDB();
}).finally(() => {
this.deleteLoadRangeEvent(startTime, endTime)
this.showLoader = false;
this.updateEventListBox()
})
} 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.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
//
this.myCal.update();
this.myCal.loadEvents();
this.showLoader = false;
this.showTimeline = true;
}).catch((error) => {
console.error(error)
this.getFromDB()
}).finally(() => {
this.deleteLoadRangeEvent(startTime, endTime)
this.showLoader = false;
this.updateEventListBox()
})
}
}
} else {
// Desktop only
let counter = 0;
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.addEventToDB(response, "md");
let eventsList = response;
this.CalendarStore.removeRange(startTime, endTime, 'md')
// loop
this.CalendarStore.pushEvent(eventsList, 'md');
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, '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) => {
console.error(error)
this.getFromDB()
}).finally(() => {
this.deleteLoadRangeEvent(startTime, endTime)
counter++;
if (counter == 2) {
this.showLoader = false;
}
this.updateEventListBox()
})
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.addEventToDB(response, "pr");
let eventsList = response;
// clear the current month only
this.CalendarStore.removeRange(startTime, endTime, 'pr')
this.CalendarStore.pushEvent(eventsList, 'pr');
this.TimelinePRList = this.listBoxService.list(this.CalendarStore.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
//
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(() => {
this.deleteLoadRangeEvent(startTime, endTime)
counter++;
if (counter == 2) {
this.showLoader = false;
}
this.updateEventListBox()
})
} else if(this.loggeduser.Profile == 'PR') {
// view PR calendar with PR profile
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, "pr");
let eventsList = response;
this.CalendarStore.removeRange(startTime, endTime, 'pr')
// loop
this.CalendarStore.pushEvent(eventsList, 'pr');
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
// console.log('this.TimelineMDList', this.TimelineMDList);
this.myCal.update();
this.myCal.loadEvents();
this.showTimelineMD = true;
this.showLoader = false;
}).catch((error) => {
console.error(error)
this.getFromDB()
}).finally(() => {
this.deleteLoadRangeEvent(startTime, endTime)
this.showLoader = false;
this.updateEventListBox()
})
if(SessionStore.user.OwnerCalendars.find(e => e.CalendarId == selectedCalendar.calendarId)) {
label = 'md'
} else {
this.showLoader = false;
label = "pr"
}
} else {
console.log('label', label)
const selectedCalendarUserId = this.selectedCalendarUserId();
this.eventService.getEventsByRoleId(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59'), selectedCalendarUserId).then((response: any) => {
// this.addEventToDB(response, label);
let eventsList = response;
this.CalendarStore.removeRangeForCalendar(startTime, endTime, label, selectedCalendar.calendarId)
this.CalendarStore.pushEvent(eventsList, label);
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
let label;
this.TimelineMDList = this.listBoxService.list(this.listToPresent, label, this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
if(selectedCalendarUserId == SessionStore.user.UserId) {
label = 'md'
} else {
label = "pr"
}
this.addEventToDB(response, label);
let eventsList = response;
this.CalendarStore.removeRange(startTime, endTime, label)
this.CalendarStore.pushEvent(eventsList, label);
this.listToPresent = this.CalendarStore.eventSource
this.TimelinePRList = this.listBoxService.list(this.CalendarStore.eventSource, label, this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
this.showTimelinePR = true;
this.myCal.update();
this.myCal.loadEvents();
}).finally(() => {
this.deleteLoadRangeEvent(startTime, endTime);
this.showTimelinePR = true;
load++
if(load == selectedCalendarIds.length) {
this.showLoader = false;
}).finally(() => {
this.deleteLoadRangeEvent(startTime, endTime)
this.showLoader = false;
this.updateEventListBox()
})
}
}
this.myCal.update();
this.myCal.loadEvents();
this.updateEventListBox()
})
}
}
selectedAgenda = {}
getSelectedAgendaCalendars () {
let Oficial = this.eventService.calendarNamesType[this.CalendarName]?.['Oficial']
let Pessoal = this.eventService.calendarNamesType[this.CalendarName]?.['Pessoal']
const calendar = this.eventService.calendarNamesType[this.CalendarName];
let Oficial = calendar?.['OficialId']
let Pessoal = calendar?.['PessoalId']
if(Oficial && Pessoal) {
return [Oficial, Pessoal]
return [
{
calendarId : Oficial,
OwnerId: calendar.OwnerId,
CalendarName: calendar.CalendarName
},
{
OwnerId: calendar.OwnerId,
calendarId : Pessoal,
CalendarName: calendar.CalendarName
}
]
} else if (Oficial) {
return [Oficial]
} else if (Pessoal) {
return [Pessoal]
return [{
OwnerId: calendar.OwnerId,
calendarId : Oficial,
CalendarName: calendar.CalendarName
}]
} else {
return [Oficial, Pessoal]
return [{
OwnerId: calendar.OwnerId,
calendarId : Pessoal,
CalendarName: calendar.CalendarName
}]
}
}
trasnformData(response, profile) {
// trasnformData(response, profile) {
response.forEach(element => {
let event = {
startTime: new Date(element.StartDate),
endTime: new Date(element.EndDate),
allDay: false,
event: element,
calendarName: element.CalendarName,
profile: profile,
id: element.EventId,
}
this.array.push(event)
});
this.listToPresent = this.array;
// response.forEach(element => {
// let event = {
// startTime: new Date(element.StartDate),
// endTime: new Date(element.EndDate),
// allDay: false,
// event: element,
// calendarName: element.CalendarName,
// profile: profile,
// id: element.EventId,
// }
// this.array.push(event)
// });
// this.listToPresent = this.array;
}
// }
//Deve ser removido para ficar só um method transform
trasnformDataDB(response) {
// //Deve ser removido para ficar só um method transform
// trasnformDataDB(response) {
if(response) {
// if(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;
// 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;
}
// }
}
// }
addEventToDB(response, profile) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
let responseArray = [];
response.forEach(element => {
let event = {
CalendarId: element.CalendarId,
CalendarName: element.CalendarName,
EndDate: element.EndDate,
EventId: element.EventId,
HasAttachments: element.HasAttachments,
HumanDate: element.HumanDate,
IsAllDayEvent: element.IsAllDayEvent,
Location: element.Location,
StartDate: element.StartDate,
Subject: element.Subject,
Profile: profile
}
responseArray.push(event)
// addEventToDB(response, profile) {
// if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
// let responseArray = [];
// response.forEach(element => {
// let event = {
// CalendarId: element.CalendarId,
// CalendarName: element.CalendarName,
// EndDate: element.EndDate,
// EventId: element.EventId,
// HasAttachments: element.HasAttachments,
// HumanDate: element.HumanDate,
// IsAllDayEvent: element.IsAllDayEvent,
// Location: element.Location,
// StartDate: element.StartDate,
// Subject: element.Subject,
// Profile: profile
// }
// responseArray.push(event)
});
// });
this.storage.set('agendaResponse',responseArray).then(() => {
// this.storage.set('agendaResponse',responseArray).then(() => {
})
} else {
if (response.length > 0) {
// })
// } else {
// if (response.length > 0) {
response.forEach(element => {
let event = {
CalendarId: element.CalendarId,
CalendarName: element.CalendarName,
EndDate: element.EndDate,
EventId: element.EventId,
HasAttachments: element.HasAttachments,
HumanDate: element.HumanDate,
IsAllDayEvent: element.IsAllDayEvent,
Location: element.Location,
StartDate: element.StartDate,
Subject: element.Subject,
Profile: profile
}
this.sqliteservice.addEvent(event)
// response.forEach(element => {
// let event = {
// CalendarId: element.CalendarId,
// CalendarName: element.CalendarName,
// EndDate: element.EndDate,
// EventId: element.EventId,
// HasAttachments: element.HasAttachments,
// HumanDate: element.HumanDate,
// IsAllDayEvent: element.IsAllDayEvent,
// Location: element.Location,
// StartDate: element.StartDate,
// Subject: element.Subject,
// Profile: profile
// }
// this.sqliteservice.addEvent(event)
});
}
}
}
// });
// }
// }
// }
getFromDB() {
// getFromDB() {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storage.get('agendaResponse').then((events) => {
this.trasnformDataDB(events)
this.updateEventListBox()
// if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
// this.storage.get('agendaResponse').then((events) => {
// this.trasnformDataDB(events)
// this.updateEventListBox()
this.myCal.update();
this.myCal.loadEvents();
// this.myCal.update();
// this.myCal.loadEvents();
this.showLoader = false;
this.showTimeline = true;
})
} else {
this.sqliteservice.getAllEvents().then((events: any[] = []) => {
// this.showLoader = false;
// this.showTimeline = true;
// })
// } else {
// this.sqliteservice.getAllEvents().then((events: any[] = []) => {
let eventArray = [];
// let eventArray = [];
this.trasnformDataDB(events)
this.updateEventListBox()
// this.trasnformDataDB(events)
// this.updateEventListBox()
this.myCal.update();
this.myCal.loadEvents();
// this.myCal.update();
// this.myCal.loadEvents();
this.showLoader = false;
this.showTimeline = true;
// this.showLoader = false;
// this.showTimeline = true;
})
}
// })
// }
}
// }
getEventsFromDB () {
// 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)
})
}
}).catch ((error) => {
console.error(error);
});
// 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)
// })
// }
// }).catch ((error) => {
// console.error(error);
// });
}
// }
updateEventListBox() {
if (window.innerWidth < 768) {
const selectedCalendarIds = this.getSelectedAgendaCalendars();
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
switch (this.segment) {
case "Combinado":
if (this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR') {
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
}
else if (this.profile == "pr" && this.loggeduser.Profile == 'MDGPR') {
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
}
else if (this.loggeduser.Profile == 'PR') {
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
} else {
if(this.profile == "pr") {
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
} else if (this.profile == "mdgpr") {
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
}
}
break;
case "Pessoal":
//Inicializa o array eventSource
if (this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR') {
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
}
else if(this.loggeduser.Profile == 'PR') {
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
this.TimelinePRList = this.listBoxService.list(this.CalendarStore.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
} else {
if(this.profile == "pr") {
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
} else if (this.profile == "mdgpr") {
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
}
}
break;
case "Oficial":
if (this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR') {
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, {segment: this.segment, selectedDate: this.eventSelectedDate})
} else if(this.loggeduser.Profile == 'PR') {
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
this.TimelinePRList = this.listBoxService.list(this.CalendarStore.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
} else {
if(this.profile == "pr") {
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
} else if (this.profile == "mdgpr") {
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
}
}
break;
}
} else {
this.TimelinePRList = this.listBoxService.list(this.CalendarStore.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'md', 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 })
}
@@ -1177,17 +874,17 @@ export class AgendaPage implements OnInit {
}
changeProfile() {
if (this.profile == "mdgpr") {
this.profile = "pr";
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
}
else {
this.profile = "mdgpr";
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'md', 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 })
}
}
@@ -1455,6 +1152,11 @@ export class AgendaPage implements OnInit {
}
}
reloadCalendar() {
//
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
}
async EventToApproveGoBack() {
}
@@ -219,7 +219,7 @@
<!-- List -->
<div *ngIf="SessionStore.user.Profile == 'Consultant' && environment.presidencial" (click)="openDiplomaPorElaborar('gerarDiplomas'); selectedElement='gerarDiplomas'" [class.active]="selectedElement == 'gerarDiplomas'" class="box-hover exp-card d-flex flex-column justify-center">
<div *ngIf="SessionStore.user.Profile == 'Consultant' && environment.presidential" (click)="openDiplomaPorElaborar('gerarDiplomas'); selectedElement='gerarDiplomas'" [class.active]="selectedElement == 'gerarDiplomas'" class="box-hover exp-card d-flex flex-column justify-center">
<div class="d-flex justify-center">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-diplomas-assinados-presidente.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement != 'gerarDiplomas'" src="assets/images/theme/gov/icons-diplomas-assinados-presidente.svg"></ion-icon>
+5 -5
View File
@@ -638,7 +638,7 @@ export class SearchPage implements OnInit {
res.Categories.forEach( e => {
e['Active'] = false;
if(!environment.presidencial) {
if(!environment.presidential) {
e['Name'] = "Publicações"
}
});
@@ -649,7 +649,7 @@ export class SearchPage implements OnInit {
}
for ( const a of this.sortArrayISODate(res.Documents)) {
if(!environment.presidencial) {
if(!environment.presidential) {
a.DocTypeDesc = "Publicações"
}
this.searchDocuments.push(a);
@@ -689,12 +689,12 @@ export class SearchPage implements OnInit {
res.Categories.forEach( e => {
e['Active'] = false;
if(!environment.presidencial) {
if(!environment.presidential) {
e['Name'] = "Acções"
}
});
if(!environment.presidencial) {
if(!environment.presidential) {
// bind respose
for ( const a of res.Categories) {
this.searchCategories.push(a);
@@ -704,7 +704,7 @@ export class SearchPage implements OnInit {
for ( const a of this.sortArrayISODate(res.Documents)) {
if(!environment.presidencial) {
if(!environment.presidential) {
a.DocTypeDesc = "Acções"
this.searchDocuments.push(a);
}
+14 -18
View File
@@ -43,21 +43,17 @@ export class ListBoxService {
// }
if(segment!='Combinado') {
eventSource = this.filterSegment(eventSource, segment)
}
// if(segment!='Combinado') {
// eventSource = this.filterSegment(eventSource, segment)
// }
if(profile != 'all') {
eventSource = this.filterProfile(eventSource, profile)
}
// if(profile != 'all') {
// eventSource = this.filterProfile(eventSource, profile)
// }
let newStracture:CustomCalendarEvent[];
if(profile == 'md') {
newStracture = this.encapsulation(eventSource, 'mdgpr');
} else {
newStracture = this.encapsulation(eventSource, 'pr');
}
newStracture = this.encapsulation(eventSource);
return this.display(newStracture, profile, selectedDate)
}
@@ -97,7 +93,7 @@ export class ListBoxService {
if (diffDays >= 1) {
const StartEvent = this.transForm(event, {startMany: true, endMany: false, middle: false, profile})
const StartEvent = this.transForm(event, {startMany: true, endMany: false, middle: false})
if(this.CanPush(event, selectedDate)) days[day].push(StartEvent)
@@ -124,12 +120,12 @@ export class ListBoxService {
startDate.getDate() != endDate.getDate())) {
// last push
const EndEvent = this.transForm(event, {startMany: false, endMany: true, middle: false, profile})
const EndEvent = this.transForm(event, {startMany: false, endMany: true, middle: false})
if(this.CanPush(event, selectedDate)) days[otherDays].push(EndEvent)
} else {
const EndEvent = this.transForm(event, {startMany: false,endMany: true, middle: true, profile})
const EndEvent = this.transForm(event, {startMany: false,endMany: true, middle: true})
if(this.CanPush(event, selectedDate)) days[otherDays].push(EndEvent)
}
@@ -172,7 +168,7 @@ export class ListBoxService {
new Date(event.start).getDate() >= selectedDate.getDate()
}
encapsulation(eventsList:EventListStore[], profile): CustomCalendarEvent[] {
encapsulation(eventsList:EventListStore[]): CustomCalendarEvent[] {
// remove all event
let events: CustomCalendarEvent[] = [];
@@ -184,7 +180,7 @@ export class ListBoxService {
end: new Date(element.endTime),
id: element.id,
event: element.event,
profile: profile
profile: element.profile
});
});
@@ -192,12 +188,12 @@ export class ListBoxService {
return events;
}
transForm(event: CustomCalendarEvent, {startMany, endMany, middle, profile}) {
transForm(event: CustomCalendarEvent, {startMany, endMany, middle}) {
return Object.assign({}, {
start: event.start,
end: event.end,
id: event.id,
profile: profile,
profile: event.profile,
event: {
Subject: event.event.Subject,
StartDate: event.event.StartDate,
+5 -2
View File
@@ -277,6 +277,7 @@ export class EventsService {
this.calendarNamesType[e.FullName][sharedCalendar.CalendarName] = true
this.calendarNamesType[e.FullName][sharedCalendar.CalendarName+'Id'] = sharedCalendar.CalendarId
this.calendarNamesType[e.FullName]['RoleId'] = sharedCalendar.CalendarRoleId
this.calendarNamesType[e.FullName]['OwnerId'] = sharedCalendar.OwnerUserId
})
}
@@ -295,6 +296,7 @@ export class EventsService {
this.calendarNamesType['Meu calendario'][OwnerCalendar.CalendarName] = true
this.calendarNamesType['Meu calendario'][OwnerCalendar.CalendarName+'Id'] = OwnerCalendar.CalendarId
this.calendarNamesType['Meu calendario']['RoleId'] = OwnerCalendar.CalendarRoleId
this.calendarNamesType['Meu calendario']['OwnerId'] = OwnerCalendar.OwnerUserId || SessionStore.user.UserId
}
@@ -525,9 +527,10 @@ export class EventsService {
return this.http.get<any>(`${geturl}`, options)
}
async getEventsByCalendarId( startdate: string, enddate: string, calendarIds: any[]) {
async getEventsByCalendarId( startdate: string, enddate: string, calendarId: string) {
const calendars = SessionStore.user.OwnerCalendars.concat(SessionStore.user.SharedCalendars)
const agendasCalendars = calendars.filter( e => calendarIds.includes(e.CalendarId))
const agendasCalendars = calendars.filter( e => e.CalendarId == calendarId)
let result = []
+22
View File
@@ -62,6 +62,16 @@ export class CalendarService {
})
}
removeRangeForCalendar(rangeStartDate, rangeEndDate, profile, calendarId) {
this._eventSource = this._eventSource.filter((e)=> {
if(new Date(rangeStartDate).getTime() <= new Date(e.startTime).getTime() &&
new Date(rangeEndDate).getTime() >= new Date(e.endTime).getTime() && e.CalendarId == calendarId) {
return false
}
return true
})
}
pushEvent(eventsList: EventList[], profile: 'pr' | 'md') {
let news = []
@@ -95,6 +105,18 @@ export class CalendarService {
}, 10)
}
getEventsByCalendarIds(ids:any[]): EventListStore[] {
let result = [];
for (const calendar of ids) {
const events = this._eventSource.filter(e => e.CalendarId == calendar.calendarId)
result = result.concat(events)
}
return result
}
delete() {
this._eventSource = []