mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
select calendar by default
This commit is contained in:
@@ -8,10 +8,10 @@ import { EventList } from '../models/agenda/AgendaEventList';
|
||||
import { ChangeProfileService } from './change-profile.service';
|
||||
import { OfflineManagerService } from 'src/app/services/offline-manager.service';
|
||||
import { catchError } from "rxjs/operators";
|
||||
import { Storage } from '@ionic/storage';
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
import { SessionStore } from '../store/session.service';
|
||||
import { calendarInterface } from '../models/user.model';
|
||||
import { Subscribe } from './subcribe';
|
||||
|
||||
|
||||
@Injectable({
|
||||
@@ -62,6 +62,8 @@ export class EventsService {
|
||||
myCalendarNames = {}
|
||||
hasAnyCalendar = false
|
||||
|
||||
onCalendarFinishLoad = new Subscribe({execute : false, deleteOnExecute: true})
|
||||
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
public user: AuthService,
|
||||
@@ -255,37 +257,36 @@ export class EventsService {
|
||||
for (let sharedCalendar of SessionStore.user.SharedCalendars) {
|
||||
this.hasAnyCalendar = true
|
||||
if(sharedCalendar?.OwnerUserId) {
|
||||
this.GetCalendarName(sharedCalendar.OwnerUserId).subscribe((e)=> {
|
||||
const e = await this.GetCalendarName(sharedCalendar.OwnerUserId).toPromise()
|
||||
|
||||
this.calendarNames[sharedCalendar.CalendarId] = e.FullName
|
||||
this.myCalendarNames[sharedCalendar.CalendarId] = e.FullName
|
||||
|
||||
if(!this.calendarNamesAry.find(x => x.Role == e.Role)) {
|
||||
|
||||
|
||||
let objectShared = {
|
||||
"Fullname": e.FullName,
|
||||
"Role": e.Role,
|
||||
"OwnerUserId": sharedCalendar.OwnerUserId,
|
||||
"RoleId": sharedCalendar.CalendarRoleId
|
||||
}
|
||||
|
||||
this.calendarNamesAry.push(objectShared)
|
||||
|
||||
if(e.Role == 'Presidente da República') {
|
||||
this.calendarNamesAryPR.push(objectShared)
|
||||
} else {
|
||||
this.calendarNamesAryNoPr.push(objectShared)
|
||||
}
|
||||
|
||||
this.calendarNamesType[e.FullName] = {}
|
||||
this.calendarNames[sharedCalendar.CalendarId] = e.FullName
|
||||
this.myCalendarNames[sharedCalendar.CalendarId] = e.FullName
|
||||
|
||||
if(!this.calendarNamesAry.find(x => x.Role == e.Role)) {
|
||||
|
||||
|
||||
let objectShared = {
|
||||
"Fullname": e.FullName,
|
||||
"Role": e.Role,
|
||||
"OwnerUserId": sharedCalendar.OwnerUserId,
|
||||
"RoleId": sharedCalendar.CalendarRoleId
|
||||
}
|
||||
|
||||
this.calendarNamesAry.push(objectShared)
|
||||
|
||||
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
|
||||
})
|
||||
if(e.Role == 'Presidente da República') {
|
||||
this.calendarNamesAryPR.push(objectShared)
|
||||
} else {
|
||||
this.calendarNamesAryNoPr.push(objectShared)
|
||||
}
|
||||
|
||||
this.calendarNamesType[e.FullName] = {}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
}
|
||||
@@ -317,6 +318,8 @@ export class EventsService {
|
||||
|
||||
this.calendarNamesAryReverse = this.calendarNamesAry.reverse();
|
||||
|
||||
this.onCalendarFinishLoad.executor();
|
||||
|
||||
(() => {
|
||||
const keys = {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user