mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
list shared calendar from new api
This commit is contained in:
@@ -45,7 +45,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div *ngIf="SessionStore.user.RoleID !== 100000014" style="
|
<div *ngIf="SessionStore.user.RoleID !== 100000014 && (sharedCalendar | async) as calendarData" style="
|
||||||
padding-bottom: 10px;
|
padding-bottom: 10px;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
@@ -53,35 +53,35 @@
|
|||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
margin-right: 10px;"
|
margin-right: 10px;"
|
||||||
class="select-calendar">
|
class="select-calendar">
|
||||||
<mat-form-field class="select-calendar" appearance="none" color="ion-color-secondary" placeholder="Selecione agenda">
|
|
||||||
<mat-select [(value)]="CalendarName" (selectionChange)="reloadCalendar()">
|
|
||||||
|
|
||||||
<mat-option *ngFor="let calendars of eventService.calendarNamesAry" value="{{calendars.Fullname || calendars}}">
|
{{ selectedUserCalendar }}
|
||||||
|
<!-- Debug line to print data -->
|
||||||
|
<mat-form-field class="select-calendar" appearance="none" color="ion-color-secondary" placeholder="Selecione agenda">
|
||||||
|
<mat-select [(value)]="selectedUserCalendar" (selectionChange)="reloadCalendar()" *ngIf="calendarData?.length">
|
||||||
|
|
||||||
|
<mat-option *ngFor="let calendars of calendarData" value="{{calendars.wxUserId}}">
|
||||||
|
|
||||||
<div *ngIf="environment.presidential">
|
<div *ngIf="environment.presidential">
|
||||||
<div *ngIf="calendars.Role == 'Presidente da República'"> PR </div>
|
<div *ngIf="calendars.roleId == RoleIdService.PRES"> PR </div>
|
||||||
<div *ngIf="calendars.Role == 'Ministro e Director do Gabinete do PR'"> MDGPR </div>
|
<div *ngIf="calendars.roleId == RoleIdService.MD"> MDGPR </div>
|
||||||
<div *ngIf="calendars.Role != 'Ministro e Director do Gabinete do PR' && calendars.Role != 'Presidente da República' && calendars.Fullname"> Agenda do {{calendars.Fullname}} </div>
|
<div *ngIf="calendars.roleId != RoleIdService.MD && calendars.roleId != RoleIdService.PRES && calendars.wxFullName"> Agenda do {{calendars.wxFullName}} </div>
|
||||||
<div *ngIf="calendars.Role != 'Presidente da República' && calendars.Role != 'Ministro e Director do Gabinete do PR' && calendars == 'Meu calendario' ">
|
<div *ngIf="calendars.roleId != RoleIdService.PRES && calendars.roleId != RoleIdService.MD && calendars.wxUserId == SessionStore.user.UserId ">
|
||||||
<!-- <span *ngIf="SessionStore.user.Profile == 'PR' ">PR</span>
|
|
||||||
<span *ngIf="SessionStore.user.Profile == 'MDGPR' ">MDGPR</span>
|
|
||||||
<span *ngIf="SessionStore.user.Profile != 'MDGPR' && SessionStore.user.Profile != 'PR' ">Minha agenda</span> -->
|
|
||||||
Minha agenda
|
Minha agenda
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngIf="!environment.presidential">
|
<div *ngIf="!environment.presidential">
|
||||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Presidente da República'"> {{ environment.agendaPR}} </div>
|
<div *ngIf="calendars.wxUserId != SessionStore.user.UserId && calendars.roleId == RoleIdService.PRES"> {{ environment.agendaPR}} </div>
|
||||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Ministro e Director do Gabinete do PR'"> {{ environment.agendaVP}} </div>
|
<div *ngIf="calendars.wxUserId != SessionStore.user.UserId && calendars.roleId == RoleIdService.MD"> {{ 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.wxUserId != SessionStore.user.UserId && calendars.roleId != RoleIdService.MD && calendars.roleId != RoleIdService.PRES"> Agenda do {{calendars.wxFullName}} </div>
|
||||||
<div *ngIf="calendars == 'Meu calendario'">Minha agenda</div>
|
<div *ngIf="calendars.wxUserId == SessionStore.user.UserId">Minha agenda</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</mat-option>
|
</mat-option>
|
||||||
|
|
||||||
<mat-option value="PR+MDGPR" *ngIf="p.userPermission([p.permissionList.Gabinete.md_tasks]) && environment.presidential">
|
<!-- <mat-option value="PR+MDGPR" *ngIf="p.userPermission([p.permissionList.Gabinete.md_tasks]) && environment.presidential">
|
||||||
PR+MDGPR
|
PR+MDGPR
|
||||||
</mat-option>
|
</mat-option> -->
|
||||||
|
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
@@ -140,6 +140,8 @@
|
|||||||
</thead>
|
</thead>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="calendar-conteiner-height overflow-hidden" [style.height]="listBoxService.height">
|
<div class="calendar-conteiner-height overflow-hidden" [style.height]="listBoxService.height">
|
||||||
<calendar
|
<calendar
|
||||||
class="calendar-component"
|
class="calendar-component"
|
||||||
@@ -230,7 +232,7 @@
|
|||||||
|
|
||||||
<div *ngFor="let day of month.days; let i = index " class="EventListBox-container" >
|
<div *ngFor="let day of month.days; let i = index " class="EventListBox-container" >
|
||||||
|
|
||||||
<div class="day" *ngIf="!(i == 0 && isSelectedDayHasEvent) || !hasEventToday" >
|
<div class="day" *ngIf="!(i == 0 && isSelectedDayHasEvent)" >
|
||||||
|
|
||||||
{{ day.daysInfo.dayName }} <div style="text-transform: capitalize; display: inline;">{{month.monthInfo.monthName}}</div>
|
{{ day.daysInfo.dayName }} <div style="text-transform: capitalize; display: inline;">{{month.monthInfo.monthName}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ import { environment } from 'src/environments/environment';
|
|||||||
import { RoleIdService } from 'src/app/services/role-id.service'
|
import { RoleIdService } from 'src/app/services/role-id.service'
|
||||||
import { EventListStore } from 'src/app/models/agenda/AgendaEventList';
|
import { EventListStore } from 'src/app/models/agenda/AgendaEventList';
|
||||||
import { Cy } from 'cypress/enum'
|
import { Cy } from 'cypress/enum'
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
import { TableSharedCalendar } from 'src/app/services/Repositorys/Agenda/agenda-local-data-source.service';
|
||||||
|
import { map } from 'rxjs/operators';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-agenda',
|
selector: 'app-agenda',
|
||||||
templateUrl: './agenda.page.html',
|
templateUrl: './agenda.page.html',
|
||||||
@@ -169,10 +172,12 @@ export class AgendaPage implements OnInit {
|
|||||||
|
|
||||||
SessionStore = SessionStore;
|
SessionStore = SessionStore;
|
||||||
environment = environment
|
environment = environment
|
||||||
CalendarName = ''
|
selectedUserCalendar: number | string = ''
|
||||||
hasEventToday = false
|
hasEventToday = false
|
||||||
isSelectedDayHasEvent = true
|
isSelectedDayHasEvent = true
|
||||||
|
|
||||||
|
sharedCalendar: Observable<TableSharedCalendar[]>
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(LOCALE_ID) private locale: string,
|
@Inject(LOCALE_ID) private locale: string,
|
||||||
private modalCtrl: ModalController,
|
private modalCtrl: ModalController,
|
||||||
@@ -188,15 +193,25 @@ export class AgendaPage implements OnInit {
|
|||||||
public AgendaDataRepositoryService: AgendaDataRepositoryService,
|
public AgendaDataRepositoryService: AgendaDataRepositoryService,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
(async () => {
|
this.AgendaDataRepositoryService.getSharedCalendar()
|
||||||
const result = await this.AgendaDataRepositoryService.getSharedCalendar()
|
|
||||||
|
// Define the role priorities
|
||||||
|
const rolePriorities: { [key: number]: number } = {
|
||||||
|
100000014: 1, // Presidente da República
|
||||||
|
100000011: 2, // Vice Presidente (example role ID)
|
||||||
|
// Add other roles with their priorities here
|
||||||
|
};
|
||||||
|
|
||||||
|
this.sharedCalendar = this.AgendaDataRepositoryService.getShareCalendarItemsLive().pipe(
|
||||||
|
map(data => data.sort((a, b) => {
|
||||||
|
console.log('Raw data:', data); // Debug line
|
||||||
|
const priorityA = rolePriorities[a.roleId] || Infinity;
|
||||||
|
const priorityB = rolePriorities[b.roleId] || Infinity;
|
||||||
|
return priorityA - priorityB;
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if(result.isOk()) {
|
|
||||||
console.log('111', result)
|
|
||||||
} else {
|
|
||||||
console.log('error')
|
|
||||||
}
|
|
||||||
})()
|
|
||||||
|
|
||||||
this.dateAdapter.setLocale('es');
|
this.dateAdapter.setLocale('es');
|
||||||
this.locale = 'pt'
|
this.locale = 'pt'
|
||||||
@@ -254,10 +269,10 @@ export class AgendaPage implements OnInit {
|
|||||||
|
|
||||||
this.weekToShow()
|
this.weekToShow()
|
||||||
|
|
||||||
this.eventService.registerOnLoadCalendars(()=> {
|
this.eventService.registerOnLoadCalendars(async ()=> {
|
||||||
|
|
||||||
this.setCalendarByDefault(true)
|
this.setCalendarByDefault(true)
|
||||||
const selectedCalendarIds = this.getSelectedAgendaCalendars();
|
const selectedCalendarIds = await this.getSelectedAgendaCalendars();
|
||||||
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
|
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
|
||||||
|
|
||||||
this.reloadCalendar()
|
this.reloadCalendar()
|
||||||
@@ -283,8 +298,11 @@ export class AgendaPage implements OnInit {
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|
||||||
this.setCalendarByDefault(false)
|
this.setCalendarByDefault(false)
|
||||||
const selectedCalendarIds = this.getSelectedAgendaCalendars();
|
this.getSelectedAgendaCalendars().then((selectedCalendarIds) => {
|
||||||
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
|
|
||||||
|
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const pathname = window.location.pathname
|
const pathname = window.location.pathname
|
||||||
@@ -360,20 +378,18 @@ export class AgendaPage implements OnInit {
|
|||||||
}, 250)
|
}, 250)
|
||||||
}
|
}
|
||||||
|
|
||||||
setCalendarByDefault(force) {
|
async setCalendarByDefault(force) {
|
||||||
if (!this.CalendarName || force) {
|
if (!this.selectedUserCalendar || force) {
|
||||||
const prObject = this.eventService.calendarNamesAry.find(e => e?.RoleId == 100000014)
|
const data = await this.AgendaDataRepositoryService.geCalendars()
|
||||||
|
|
||||||
|
const prObject = data.find(e => e?.roleId == 100000014)
|
||||||
|
|
||||||
if(prObject) {
|
if(prObject) {
|
||||||
console.log({prObject})
|
this.selectedUserCalendar = prObject.wxUserId
|
||||||
this.CalendarName = prObject.Fullname
|
|
||||||
} else if (this.eventService.calendarNamesAry.includes('Meu calendario')) {
|
|
||||||
this.CalendarName = 'Meu calendario';
|
|
||||||
} else {
|
} else {
|
||||||
this.CalendarName = this.eventService.calendarNamesAry[0]
|
this.selectedUserCalendar = SessionStore.user.UserId
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Go to the next view of the calendar month/week/day
|
//Go to the next view of the calendar month/week/day
|
||||||
@@ -628,10 +644,10 @@ export class AgendaPage implements OnInit {
|
|||||||
removeDuplicatesByOwnerUserId = (array) => {
|
removeDuplicatesByOwnerUserId = (array) => {
|
||||||
const seen = new Set();
|
const seen = new Set();
|
||||||
return array.filter(item => {
|
return array.filter(item => {
|
||||||
if (seen.has(item.OwnerUserId)) {
|
if (seen.has(item.wxUserId)) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
seen.add(item.OwnerUserId);
|
seen.add(item.wxUserId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -646,9 +662,16 @@ export class AgendaPage implements OnInit {
|
|||||||
this.rangeStartDate = startTime
|
this.rangeStartDate = startTime
|
||||||
this.rangeEndDate = endTime
|
this.rangeEndDate = endTime
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.showLoader = true;
|
this.showLoader = true;
|
||||||
const selectedCalendarIds = this.removeDuplicatesByOwnerUserId(this.getSelectedAgendaCalendars());
|
const selectedCalendarIds = await this.getSelectedAgendaCalendars()
|
||||||
|
|
||||||
|
console.log({selectedCalendarIds})
|
||||||
|
|
||||||
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
|
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
|
||||||
|
|
||||||
|
console.log('listToPresent', this.listToPresent)
|
||||||
// this.calendar.currentDate.setDate(1);
|
// this.calendar.currentDate.setDate(1);
|
||||||
|
|
||||||
this.updateEventListBox()
|
this.updateEventListBox()
|
||||||
@@ -663,8 +686,8 @@ export class AgendaPage implements OnInit {
|
|||||||
for (const selectedCalendar of selectedCalendarIds) {
|
for (const selectedCalendar of selectedCalendarIds) {
|
||||||
|
|
||||||
const response = await this.AgendaDataRepositoryService.EventList({
|
const response = await this.AgendaDataRepositoryService.EventList({
|
||||||
userId: selectedCalendar.OwnerUserId,
|
userId: selectedCalendar.wxUserId,
|
||||||
calendarOwnerName: selectedCalendar['FullName'],
|
calendarOwnerName: selectedCalendar.wxFullName,
|
||||||
endDate: endTime.toISOString(),
|
endDate: endTime.toISOString(),
|
||||||
startDate: startTime.toISOString()
|
startDate: startTime.toISOString()
|
||||||
})
|
})
|
||||||
@@ -674,16 +697,16 @@ export class AgendaPage implements OnInit {
|
|||||||
|
|
||||||
if (SessionStore.user.Profile == 'PR') {
|
if (SessionStore.user.Profile == 'PR') {
|
||||||
label = "pr"
|
label = "pr"
|
||||||
} else if (selectedCalendar.OwnerUserId == SessionStore.user.UserId as any) {
|
} else if (selectedCalendar.wxUserId == SessionStore.user.UserId as any) {
|
||||||
label = 'md'
|
label = 'md'
|
||||||
} else {
|
} else {
|
||||||
label = "pr"
|
label = "pr"
|
||||||
}
|
}
|
||||||
|
|
||||||
this.CalendarStore.removeRangeForCalendar(startTime, endTime, null , selectedCalendar.OwnerUserId as any)
|
this.CalendarStore.removeRangeForCalendar(startTime, endTime, null , selectedCalendar.wxUserId as any)
|
||||||
|
|
||||||
let eventsList = response.value;
|
let eventsList = response.value;
|
||||||
this.CalendarStore.pushEvent(eventsList, label, selectedCalendar.OwnerUserId);
|
this.CalendarStore.pushEvent(eventsList, label, selectedCalendar.wxUserId);
|
||||||
|
|
||||||
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
|
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
|
||||||
|
|
||||||
@@ -716,77 +739,33 @@ export class AgendaPage implements OnInit {
|
|||||||
|
|
||||||
selectedAgenda = {}
|
selectedAgenda = {}
|
||||||
|
|
||||||
getSelectedAgendaCalendars(): any {
|
async getSelectedAgendaCalendars() {
|
||||||
|
|
||||||
if (this.CalendarName == 'PR+MDGPR') {
|
if (this.selectedUserCalendar == 'PR+MDGPR') {
|
||||||
|
|
||||||
const pr = this.SessionStore.user.SharedCalendars.filter(e => e.CalendarRoleId == this.RoleIdService.PRES.toString())
|
const data = await this.AgendaDataRepositoryService.geCalendars()
|
||||||
|
|
||||||
|
const prObject = data.find(e => e?.roleId == 100000014)
|
||||||
|
|
||||||
return[{
|
return[{
|
||||||
...this.eventService.calendarNamesType['Meu calendario'],
|
...this.eventService.calendarNamesType['Meu calendario'],
|
||||||
OwnerUserId: this.SessionStore.user.UserId
|
wxUserId: this.SessionStore.user.UserId
|
||||||
}, {
|
}, {
|
||||||
...pr[0]
|
...prObject
|
||||||
}]
|
}]
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
const calendar = this.eventService.calendarNamesType[this.CalendarName];
|
const data = await this.AgendaDataRepositoryService.geCalendars()
|
||||||
let Oficial = calendar?.['OficialId']
|
|
||||||
let Pessoal = calendar?.['PessoalId']
|
|
||||||
|
|
||||||
if (Oficial && Pessoal) {
|
|
||||||
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
OwnerUserId: calendar.OwnerId,
|
|
||||||
CalendarId: Oficial,
|
|
||||||
OwnerId: calendar.OwnerId,
|
|
||||||
CalendarName: calendar.CalendarName,
|
|
||||||
FullName: calendar.FullName
|
|
||||||
},
|
|
||||||
{
|
|
||||||
OwnerUserId: calendar.OwnerId,
|
|
||||||
OwnerId: calendar.OwnerId,
|
|
||||||
CalendarId: Pessoal,
|
|
||||||
CalendarName: calendar.CalendarName,
|
|
||||||
FullName: calendar.FullName
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
} else if (Oficial) {
|
|
||||||
try {
|
|
||||||
return [{
|
|
||||||
OwnerUserId: calendar.OwnerId,
|
|
||||||
OwnerId: calendar.OwnerId,
|
|
||||||
CalendarId: Oficial,
|
|
||||||
CalendarName: calendar.CalendarName,
|
|
||||||
FullName: calendar.FullName
|
|
||||||
}]
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
return [{
|
|
||||||
OwnerUserId: calendar.OwnerId,
|
|
||||||
OwnerId: calendar.OwnerId,
|
|
||||||
CalendarId: Pessoal,
|
|
||||||
CalendarName: calendar.CalendarName,
|
|
||||||
FullName: calendar.FullName
|
|
||||||
}]
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
return [data.find(e => e?.wxUserId == this.selectedUserCalendar)]
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateEventListBox() {
|
async updateEventListBox() {
|
||||||
|
|
||||||
const selectedCalendarIds = this.removeDuplicatesByOwnerUserId(this.getSelectedAgendaCalendars());
|
const selectedCalendarIds = await this.getSelectedAgendaCalendars()
|
||||||
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
|
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
|
||||||
|
|
||||||
const year = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
|
const year = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ export class AgendaDataRepositoryService {
|
|||||||
if(result.isOk()) {
|
if(result.isOk()) {
|
||||||
await this.agendaLocalDataSourceService.clearSharedCalendar()
|
await this.agendaLocalDataSourceService.clearSharedCalendar()
|
||||||
if(result.value?.data) {
|
if(result.value?.data) {
|
||||||
return await this.agendaLocalDataSourceService.create(result.value.data)
|
return await this.agendaLocalDataSourceService.bulkCreate(result.value.data)
|
||||||
} else {
|
} else {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
@@ -186,4 +186,12 @@ export class AgendaDataRepositoryService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getShareCalendarItemsLive() {
|
||||||
|
return this.agendaLocalDataSourceService.getShareCalendarItemsLive()
|
||||||
|
}
|
||||||
|
|
||||||
|
async geCalendars() {
|
||||||
|
return await this.agendaLocalDataSourceService.geCalendars()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { Dexie, EntityTable, liveQuery } from 'Dexie';
|
|||||||
import { SharedCalendarListItemOutputDTO, SharedCalendarListOutputDTO } from './model/sharedCalendarOutputDTO';
|
import { SharedCalendarListItemOutputDTO, SharedCalendarListOutputDTO } from './model/sharedCalendarOutputDTO';
|
||||||
import { any, z } from 'zod';
|
import { any, z } from 'zod';
|
||||||
import { err, ok } from 'neverthrow';
|
import { err, ok } from 'neverthrow';
|
||||||
|
import { from } from 'rxjs';
|
||||||
|
|
||||||
|
|
||||||
const tableScharedCalendar = z.object({
|
const tableScharedCalendar = z.object({
|
||||||
@@ -34,17 +35,16 @@ export class AgendaLocalDataSourceService {
|
|||||||
|
|
||||||
constructor() { }
|
constructor() { }
|
||||||
|
|
||||||
async create(data: SharedCalendarListItemOutputDTO[]) {
|
async bulkCreate(data: SharedCalendarListItemOutputDTO[]) {
|
||||||
// db.eve
|
// db.eve
|
||||||
try {
|
try {
|
||||||
const result = AgendaDataSource.shareCalendar.bulkAdd(data)
|
const result = await AgendaDataSource.shareCalendar.bulkAdd(data)
|
||||||
return ok(result)
|
return ok(result)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return err(false)
|
return err(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
clearSharedCalendar() {
|
clearSharedCalendar() {
|
||||||
// db.eve
|
// db.eve
|
||||||
try {
|
try {
|
||||||
@@ -53,6 +53,15 @@ export class AgendaLocalDataSourceService {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
return err(false)
|
return err(false)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async geCalendars() {
|
||||||
|
return await AgendaDataSource.shareCalendar.toArray()
|
||||||
|
}
|
||||||
|
|
||||||
|
getShareCalendarItemsLive() {
|
||||||
|
return from(liveQuery( () => {
|
||||||
|
return AgendaDataSource.shareCalendar.toArray()
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ export class ListBoxService {
|
|||||||
// daysObject[day] = object[day]
|
// daysObject[day] = object[day]
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
console.log('newStracture', newStracture)
|
||||||
|
|
||||||
return this.display(newStracture, selectedDate).year
|
return this.display(newStracture, selectedDate).year
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export class RoleIdService {
|
|||||||
* @description President role id
|
* @description President role id
|
||||||
*/
|
*/
|
||||||
PV: number = 100000011
|
PV: number = 100000011
|
||||||
|
MD: number = 100000011
|
||||||
/**
|
/**
|
||||||
* @description Vice president role id
|
* @description Vice president role id
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -109,11 +109,11 @@ export class CalendarService {
|
|||||||
}, 10)
|
}, 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
getEventsByCalendarIds(ids:Object[]): EventListStore[] {
|
getEventsByCalendarIds(ids:any[]): EventListStore[] {
|
||||||
|
|
||||||
let result = [];
|
let result = [];
|
||||||
for (const calendar of ids) {
|
for (const calendar of ids) {
|
||||||
const events = this._eventSource.filter(e => e.CalendarId == calendar['OwnerUserId'])
|
const events = this._eventSource.filter(e => e.CalendarId == calendar.wxUserId )
|
||||||
result = result.concat(events)
|
result = result.concat(events)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user