mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
merge with Peter alterations
This commit is contained in:
@@ -34,8 +34,6 @@ export class ListBoxService {
|
||||
|
||||
list(eventSource: EventListStore[], profile: 'md' | 'pr' | 'all', rangeStartDate, randEndDate, {segment = 'Combinado', selectedDate= null}) {
|
||||
|
||||
//
|
||||
|
||||
// // filter range
|
||||
// if(selectedDate) {
|
||||
// eventSource = eventSource.filter(data =>
|
||||
@@ -67,35 +65,41 @@ export class ListBoxService {
|
||||
display(list: CustomCalendarEvent[], profile, selectedDate) {
|
||||
let days = {};
|
||||
|
||||
list.forEach( (event:CustomCalendarEvent, index)=> {
|
||||
list.forEach( (event:CustomCalendarEvent, index) => {
|
||||
|
||||
|
||||
var startDate: any = new Date(event.start);
|
||||
|
||||
var endDate: any = this.dateService.EventEndDateTreatment({
|
||||
startTime: startDate,
|
||||
startTime: startDate,
|
||||
endTime: event.end
|
||||
})
|
||||
|
||||
|
||||
|
||||
const day = this.dateService.getDay(event.start)
|
||||
|
||||
event['manyDays'] = false
|
||||
event['manyDays'] = !this.dateService.isSameDate(event.start, event.end)
|
||||
event['todayOnly'] = this.dateService.isSameDate(event.start, event.end)
|
||||
|
||||
|
||||
if(!days.hasOwnProperty(day)) {
|
||||
days[day] = []
|
||||
}
|
||||
|
||||
const diffDays = this.dateService.deferenceBetweenDays(endDate, startDate)
|
||||
|
||||
if (this.dateService.notSameDate(startDate, endDate)) {
|
||||
|
||||
const diffDays = this.dateService.deferenceBetweenDays(endDate, startDate)
|
||||
|
||||
|
||||
if (diffDays <= 150 && !event.event.IsAllDayEvent ) {
|
||||
|
||||
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, profile})
|
||||
|
||||
if(this.push(event, selectedDate)) days[day].push(StartEvent)
|
||||
if(this.CanPush(event, selectedDate)) days[day].push(StartEvent)
|
||||
|
||||
let i = 1;
|
||||
|
||||
@@ -120,13 +124,13 @@ export class ListBoxService {
|
||||
startDate.getDate() != endDate.getDate())) {
|
||||
// last push
|
||||
|
||||
const EndEvent = this.transForm(event, {startMany: false,endMany: true, middle: false, profile})
|
||||
if(this.push(event, selectedDate)) days[otherDays].push(EndEvent)
|
||||
const EndEvent = this.transForm(event, {startMany: false, endMany: true, middle: false, profile})
|
||||
if(this.CanPush(event, selectedDate)) days[otherDays].push(EndEvent)
|
||||
|
||||
} else {
|
||||
|
||||
const EndEvent = this.transForm(event, {startMany: false,endMany: true, middle: true, profile})
|
||||
if(this.push(event, selectedDate)) days[otherDays].push(EndEvent)
|
||||
const EndEvent = this.transForm(event, {startMany: false,endMany: true, middle: true, profile})
|
||||
if(this.CanPush(event, selectedDate)) days[otherDays].push(EndEvent)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -134,33 +138,32 @@ export class ListBoxService {
|
||||
} else {
|
||||
|
||||
|
||||
if(this.push(event, selectedDate)) days[day].push(event)
|
||||
if(this.CanPush(event, selectedDate)) days[day].push(event)
|
||||
}
|
||||
} else {
|
||||
|
||||
if(this.push(event, selectedDate)) days[day].push(event)
|
||||
if(this.CanPush(event, selectedDate)) days[day].push(event)
|
||||
}
|
||||
}
|
||||
|
||||
if(this.push(event, selectedDate)) days[day].push(event)
|
||||
// if(this.CanPush(event, selectedDate) && diffDays != 2) days[day].push(event)
|
||||
|
||||
})
|
||||
|
||||
// remove days that haven't event
|
||||
Object.entries(days).forEach(([index, value]) => {
|
||||
const _value: any = value
|
||||
// remove days that haven't event
|
||||
Object.entries(days).forEach(([index, value]) => {
|
||||
const _value: any = value
|
||||
|
||||
if(_value.length == 0) {
|
||||
delete days[index]
|
||||
}
|
||||
if(_value.length == 0) {
|
||||
delete days[index]
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
return days
|
||||
}
|
||||
|
||||
|
||||
push(event: any, selectedDate: Date) {
|
||||
CanPush(event: any, selectedDate: Date) {
|
||||
|
||||
return new Date(event.start).getMonth() == selectedDate.getMonth() &&
|
||||
new Date(event.start).getFullYear() == selectedDate.getFullYear() &&
|
||||
@@ -187,28 +190,26 @@ export class ListBoxService {
|
||||
return events;
|
||||
}
|
||||
|
||||
|
||||
transForm(event: CustomCalendarEvent, {startMany, endMany, middle, profile}) {
|
||||
return Object.assign({}, {
|
||||
start: event.start,
|
||||
end: event.end,
|
||||
id: event.id,
|
||||
profile: profile,
|
||||
event: {
|
||||
Subject: event.event.Subject,
|
||||
StartDate: event.event.StartDate,
|
||||
EndDate: event.event.EndDate,
|
||||
Location: event.event.Location,
|
||||
EventId: event.event.EventId,
|
||||
CalendarName: event.event.CalendarName,
|
||||
CalendarId: event.event.CalendarId
|
||||
},
|
||||
Subject: event.event.Subject,
|
||||
startMany: false,
|
||||
endMany: true,
|
||||
middle: true
|
||||
})
|
||||
}
|
||||
|
||||
transForm(event: CustomCalendarEvent, {startMany, endMany, middle, profile}) {
|
||||
return Object.assign({}, {
|
||||
start: event.start,
|
||||
end: event.end,
|
||||
id: event.id,
|
||||
profile: profile,
|
||||
event: {
|
||||
Subject: event.event.Subject,
|
||||
StartDate: event.event.StartDate,
|
||||
EndDate: event.event.EndDate,
|
||||
Location: event.event.Location,
|
||||
EventId: event.event.EventId,
|
||||
CalendarName: event.event.CalendarName,
|
||||
CalendarId: event.event.CalendarId
|
||||
},
|
||||
Subject: event.event.Subject,
|
||||
startMany: startMany,
|
||||
endMany: endMany,
|
||||
middle: middle
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user