mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
Improve
This commit is contained in:
@@ -8,8 +8,8 @@ import { DateService } from '../date.service';
|
||||
export class ListBoxService {
|
||||
|
||||
constructor(
|
||||
private dateService: DateService
|
||||
){}
|
||||
private dateService: DateService
|
||||
){}
|
||||
|
||||
|
||||
filterProfile(eventSource: EventListStore[], profile: 'md' | 'pr' | 'all') {
|
||||
@@ -26,32 +26,34 @@ export class ListBoxService {
|
||||
})
|
||||
}
|
||||
|
||||
filterSegment(eventSource: EventListStore[], segment): EventListStore[] {
|
||||
return eventSource.filter( data => data.calendarName == segment)
|
||||
}
|
||||
|
||||
filterSegment(eventSource: EventListStore[], segment): EventListStore[] {
|
||||
return eventSource.filter( data => data.calendarName == segment)
|
||||
}
|
||||
|
||||
daysBetween(){ }
|
||||
|
||||
list(eventSource: EventListStore[], profile: 'md' | 'pr' | 'all', rangeStartDate, randEndDate, {segment = 'Combinado', selectedDate= null}) {
|
||||
|
||||
// filter range
|
||||
if(selectedDate) {
|
||||
eventSource = eventSource.filter(data =>
|
||||
data.startTime.toLocaleDateString('pt')>= selectedDate.toLocaleDateString('pt') &&
|
||||
data.endTime.toLocaleDateString('pt')>= selectedDate.toLocaleDateString('pt')
|
||||
)
|
||||
}
|
||||
// console.log('eventSource', eventSource ,'rangeStartDate', new Date(rangeStartDate).toLocaleDateString('pt') , 'randEndDate', new Date(randEndDate).toLocaleDateString('pt'))
|
||||
|
||||
if(segment!='Combinado') {
|
||||
eventSource = this.filterSegment(eventSource, segment)
|
||||
}
|
||||
// // filter range
|
||||
// if(selectedDate) {
|
||||
// eventSource = eventSource.filter(data =>
|
||||
// data.startTime.toLocaleDateString('pt') >= new Date(rangeStartDate).toLocaleDateString('pt') &&
|
||||
// data.startTime.toLocaleDateString('pt') <= new Date(rangeStartDate).toLocaleDateString('pt')
|
||||
// )
|
||||
// }
|
||||
|
||||
|
||||
if(segment!='Combinado') {
|
||||
eventSource = this.filterSegment(eventSource, segment)
|
||||
}
|
||||
|
||||
if(profile != 'all') {
|
||||
eventSource = this.filterProfile(eventSource, profile)
|
||||
}
|
||||
|
||||
let newStracture:CustomCalendarEvent[];
|
||||
let newStracture:CustomCalendarEvent[];
|
||||
|
||||
if(profile == 'md') {
|
||||
newStracture = this.encapsulation(eventSource, 'mdgpr');
|
||||
|
||||
Reference in New Issue
Block a user