mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
fix duplication events
This commit is contained in:
@@ -611,6 +611,19 @@ export class AgendaPage implements OnInit {
|
|||||||
delete this.loadRequest[index]
|
delete this.loadRequest[index]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
removeDuplicatesByOwnerUserId = (array) => {
|
||||||
|
const seen = new Set();
|
||||||
|
return array.filter(item => {
|
||||||
|
if (seen.has(item.OwnerUserId)) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
seen.add(item.OwnerUserId);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
async loadRangeEventRun(startTime: Date, endTime: Date) {
|
async loadRangeEventRun(startTime: Date, endTime: Date) {
|
||||||
|
|
||||||
if (SessionStore.user.OwnerCalendars.length == 0 && SessionStore.user.SharedCalendars.length == 0) {
|
if (SessionStore.user.OwnerCalendars.length == 0 && SessionStore.user.SharedCalendars.length == 0) {
|
||||||
@@ -632,8 +645,9 @@ export class AgendaPage implements OnInit {
|
|||||||
this.myCal.loadEvents();
|
this.myCal.loadEvents();
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
|
|
||||||
|
|
||||||
let load = 0;
|
let load = 0;
|
||||||
for (const selectedCalendar of selectedCalendarIds) {
|
for (const selectedCalendar of this.removeDuplicatesByOwnerUserId(selectedCalendarIds)) {
|
||||||
|
|
||||||
const response = await this.AgendaDataRepositoryService.EventList({userId: selectedCalendar.OwnerUserId, calendarOwnerName: selectedCalendar['FullName'] })
|
const response = await this.AgendaDataRepositoryService.EventList({userId: selectedCalendar.OwnerUserId, calendarOwnerName: selectedCalendar['FullName'] })
|
||||||
|
|
||||||
@@ -654,6 +668,7 @@ export class AgendaPage implements OnInit {
|
|||||||
this.CalendarStore.pushEvent(eventsList, label, selectedCalendar.OwnerUserId);
|
this.CalendarStore.pushEvent(eventsList, label, selectedCalendar.OwnerUserId);
|
||||||
|
|
||||||
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
|
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
|
||||||
|
// console.log('this.listToPresent', this.listToPresent)
|
||||||
this.showTimelinePR = true;
|
this.showTimelinePR = true;
|
||||||
|
|
||||||
load++
|
load++
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ export class ViewEventPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setTimeZone() {
|
setTimeZone() {
|
||||||
this.TimeZoneString = this.loadedEvent.TimeZone.split(')')[1]
|
this.TimeZoneString = this.loadedEvent.TimeZone
|
||||||
}
|
}
|
||||||
|
|
||||||
async loadEvent() {
|
async loadEvent() {
|
||||||
|
|||||||
@@ -1,5 +1,15 @@
|
|||||||
import { EventOutputDTO } from "../model/eventDTOOutput"
|
import { EventOutputDTO } from "../model/eventDTOOutput"
|
||||||
|
|
||||||
|
function getTextInsideParentheses(inputString) {
|
||||||
|
var startIndex = inputString.indexOf('(');
|
||||||
|
var endIndex = inputString.indexOf(')');
|
||||||
|
if (startIndex !== -1 && endIndex !== -1) {
|
||||||
|
return inputString.substring(startIndex + 1, endIndex);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class EventMapper {
|
export class EventMapper {
|
||||||
|
|
||||||
constructor() {}
|
constructor() {}
|
||||||
@@ -25,9 +35,10 @@ export class EventMapper {
|
|||||||
EmailAddress: e.emailAddress,
|
EmailAddress: e.emailAddress,
|
||||||
Name: e.name,
|
Name: e.name,
|
||||||
IsRequired: e.attendeeType == '0' ? true : false,
|
IsRequired: e.attendeeType == '0' ? true : false,
|
||||||
|
//IsRequired: e.attendeeType == 'Acknowledgment',
|
||||||
UserType: "GD",
|
UserType: "GD",
|
||||||
// "IsPR": false,
|
// "IsPR": false,
|
||||||
Acknowledgment: e.attendeeType == '0' ? true : false,
|
// Acknowledgment: e.attendeeType == '0' ? true : false,
|
||||||
// "RoleDescription": null,
|
// "RoleDescription": null,
|
||||||
// "RoleId": 0
|
// "RoleId": 0
|
||||||
})),
|
})),
|
||||||
@@ -35,7 +46,7 @@ export class EventMapper {
|
|||||||
"IsRecurring": dto.isRecurring,
|
"IsRecurring": dto.isRecurring,
|
||||||
"IsAllDayEvent": dto.isAllDayEvent,
|
"IsAllDayEvent": dto.isAllDayEvent,
|
||||||
"AppointmentState": 1,
|
"AppointmentState": 1,
|
||||||
"TimeZone": "UTC",
|
"TimeZone": getTextInsideParentheses(new Date(dto.startDate)+ ''),
|
||||||
"Organizer": {
|
"Organizer": {
|
||||||
"Id": dto.organizer.wxUserId,
|
"Id": dto.organizer.wxUserId,
|
||||||
"EmailAddress": dto.organizer.wxeMail,
|
"EmailAddress": dto.organizer.wxeMail,
|
||||||
|
|||||||
@@ -1,6 +1,17 @@
|
|||||||
import { EventToApproveDetails } from "src/app/models/entiry/agenda/eventToApproveDetails"
|
import { EventToApproveDetails } from "src/app/models/entiry/agenda/eventToApproveDetails"
|
||||||
import { EventOutputDTO } from "../model/eventDTOOutput"
|
import { EventOutputDTO } from "../model/eventDTOOutput"
|
||||||
|
|
||||||
|
function getTextInsideParentheses(inputString) {
|
||||||
|
var startIndex = inputString.indexOf('(');
|
||||||
|
var endIndex = inputString.indexOf(')');
|
||||||
|
if (startIndex !== -1 && endIndex !== -1) {
|
||||||
|
return inputString.substring(startIndex + 1, endIndex);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export class EventToApproveDetailsMapper {
|
export class EventToApproveDetailsMapper {
|
||||||
|
|
||||||
constructor() {}
|
constructor() {}
|
||||||
@@ -63,7 +74,7 @@ export class EventToApproveDetailsMapper {
|
|||||||
// "MDEmail": "evilarinho@gabinetedigital.local",
|
// "MDEmail": "evilarinho@gabinetedigital.local",
|
||||||
// "OriginatorComments": "",
|
// "OriginatorComments": "",
|
||||||
"Status": "Active",
|
"Status": "Active",
|
||||||
//"TimeZone": "",
|
"TimeZone": getTextInsideParentheses(new Date(dto.startDate)+ ''),
|
||||||
"Agenda": category ,
|
"Agenda": category ,
|
||||||
"EventType": "Reunião",
|
"EventType": "Reunião",
|
||||||
//"EventID": "",
|
//"EventID": "",
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export class EventListToApproveMapper {
|
|||||||
Agenda: dto.category,
|
Agenda: dto.category,
|
||||||
EndDate: dto.endDate,
|
EndDate: dto.endDate,
|
||||||
StartDate: dto.startDate,
|
StartDate: dto.startDate,
|
||||||
Subject: dto.body,
|
Subject: dto.subject,
|
||||||
Location: dto.location,
|
Location: dto.location,
|
||||||
Status: dto.status,
|
Status: dto.status,
|
||||||
IsAllDayEvent: dto.isAllDayEvent,
|
IsAllDayEvent: dto.isAllDayEvent,
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ const CommentSchema = z.object({
|
|||||||
const AttendeeSchema = z.object({
|
const AttendeeSchema = z.object({
|
||||||
id: z.string(),
|
id: z.string(),
|
||||||
name: z.string(),
|
name: z.string(),
|
||||||
attendeeType: EAttendeeTypeDTO,
|
attendeeType: z.enum(["0", "1", "2"]),
|
||||||
emailAddress: z.string(),
|
emailAddress: z.string(),
|
||||||
wxUserId: z.number(),
|
wxUserId: z.number(),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -75,6 +75,8 @@ 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
|
||||||
|
|
||||||
// const daysStringNum = Object.keys(daysObject)
|
// const daysStringNum = Object.keys(daysObject)
|
||||||
@@ -116,7 +118,6 @@ export class ListBoxService {
|
|||||||
event['manyDays'] = !this.dateService.isSameDate(event.start, event.end)
|
event['manyDays'] = !this.dateService.isSameDate(event.start, event.end)
|
||||||
event['todayOnly'] = this.dateService.isSameDate(event.start, event.end)
|
event['todayOnly'] = this.dateService.isSameDate(event.start, event.end)
|
||||||
|
|
||||||
|
|
||||||
if(!days.hasOwnProperty(day)) {
|
if(!days.hasOwnProperty(day)) {
|
||||||
days[day] = []
|
days[day] = []
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { HttpClient, HttpErrorResponse, HttpHeaderResponse, HttpHeaders } from '@angular/common/http';
|
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { ok, err } from 'neverthrow';
|
import { ok, err, Result } from 'neverthrow';
|
||||||
import { environment } from 'src/environments/environment';
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@@ -10,21 +9,43 @@ export class HttpService {
|
|||||||
|
|
||||||
constructor(private http:HttpClient) { }
|
constructor(private http:HttpClient) { }
|
||||||
|
|
||||||
async post(serviceName:string, data:any) {
|
async post<T>(url: string, body: any): Promise<Result<T, HttpErrorResponse>> {
|
||||||
const headers = new HttpHeaders();
|
|
||||||
const url = environment.apiChatUrl+serviceName;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await this.http.post(url, {}).toPromise()
|
const result = await this.http.post(url, body).toPromise()
|
||||||
return ok (result)
|
return ok (result as T)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return err(e as HttpErrorResponse)
|
return err(e as HttpErrorResponse)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async get(serviceName:string, options:any) {
|
async get<T>(url: string): Promise<Result<T, HttpErrorResponse>> {
|
||||||
const url = environment.apiChatUrl+serviceName;
|
try {
|
||||||
return this.http.get(url, options);
|
const result = await this.http.get<T>(url).toPromise()
|
||||||
|
return ok (result as T)
|
||||||
|
} catch (e) {
|
||||||
|
return err(e as HttpErrorResponse)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async put<T>(url: string, body: any): Promise<Result<T, HttpErrorResponse>> {
|
||||||
|
|
||||||
|
try {
|
||||||
|
const result = await this.http.put<T>(url, body).toPromise()
|
||||||
|
return ok (result as T)
|
||||||
|
} catch (e) {
|
||||||
|
return err(e as HttpErrorResponse)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async delete<T>(url: string): Promise<Result<T, HttpErrorResponse>> {
|
||||||
|
|
||||||
|
try {
|
||||||
|
const result = await this.http.delete<T>(url).toPromise()
|
||||||
|
return ok (result as T)
|
||||||
|
} catch (e) {
|
||||||
|
return err(e as HttpErrorResponse)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ export class ViewEventPage implements OnInit {
|
|||||||
|
|
||||||
|
|
||||||
setTimeZone() {
|
setTimeZone() {
|
||||||
this.TimeZoneString = this.loadedEvent.TimeZone.split(')')[1]
|
this.TimeZoneString = this.loadedEvent.TimeZone
|
||||||
}
|
}
|
||||||
async loadEvent() {
|
async loadEvent() {
|
||||||
|
|
||||||
|
|||||||
@@ -63,9 +63,10 @@ export class CalendarService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
removeRangeForCalendar(rangeStartDate, rangeEndDate, profile, calendarId) {
|
removeRangeForCalendar(rangeStartDate, rangeEndDate, profile, calendarId) {
|
||||||
|
|
||||||
this._eventSource = this._eventSource.filter((e)=> {
|
this._eventSource = this._eventSource.filter((e)=> {
|
||||||
if(new Date(rangeStartDate).getTime() <= new Date(e.startTime).getTime() &&
|
if(new Date(rangeStartDate).getTime() <= new Date(e.startTime).getTime() &&
|
||||||
new Date(rangeEndDate).getTime() >= new Date(e.endTime).getTime() && e.CalendarId == calendarId) {
|
new Date(rangeEndDate).getTime() >= new Date(e.endTime).getTime() && e.CalendarId != calendarId) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
@@ -77,16 +78,23 @@ export class CalendarService {
|
|||||||
let news = []
|
let news = []
|
||||||
eventsList.forEach((element, eventIndex) => {
|
eventsList.forEach((element, eventIndex) => {
|
||||||
|
|
||||||
news.push({
|
const found = this._eventSource.find( e => e.id == element.EventId)
|
||||||
startTime: new Date(element.StartDate),
|
|
||||||
endTime: new Date(element.EndDate),
|
if(!found) {
|
||||||
allDay: false,
|
news.push({
|
||||||
event: element,
|
startTime: new Date(element.StartDate),
|
||||||
calendarName: element.CalendarName,
|
endTime: new Date(element.EndDate),
|
||||||
profile: profile,
|
allDay: false,
|
||||||
id: element.EventId,
|
event: element,
|
||||||
CalendarId: CalendarId
|
calendarName: element.CalendarName,
|
||||||
});
|
profile: profile,
|
||||||
|
id: element.EventId,
|
||||||
|
CalendarId: CalendarId
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.log('found')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user