mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
change agenda
This commit is contained in:
@@ -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, </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, </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>
|
||||
|
||||
|
||||
@@ -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
@@ -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() {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user