@ViewChild('timelineSchedule')
public scheduleObj: ScheduleComponent;
public selectedDate: Date = new Date();
public currentView: string = 'TimelineMonth';
public views: Array<string> = ['TimelineWeek', 'TimelineMonth'];
public rowAutoHeight: Boolean = true;
public eventSettings: EventSettingsModel = {
dataSource: []
};
public group: GroupModel = {
resources: ['Vehicles']
};
public allowMultipleOwner: Boolean = true;
public ownerDataSource: Object[] = [
];
constructor(
private schedulerService: SchedulerService,
private translate: TranslateService,
private notifications: NotificationsService,
private router: Router
) { }
schedulerData: any[] = [];
isLoading: boolean;
public async getSchedulerData() {
try {
this.isLoading = true;
const data = await this.schedulerService.getVehiclesbyReservations().toPromise();
console.log(data);
this.schedulerData = await data.vehicles;
let i = 1;
let reservationData = [];
this.schedulerData.forEach(data => {
let brand = data?.brand;
let carModel = data?.carModel;
let generationYear = data?.generationYear;
let reservations = data?.reservations;
this.ownerDataSource.push({ vehicleName: brand + " " + carModel + " " + generationYear, vehicleID: i, vehicleColor: '#500ade' });
reservations.forEach(reservation => {
reservationData.push({
Id: i,
Subject: brand + " " + carModel + " " + generationYear,
StartTime: reservation.startDate,
EndTime: reservation.endDate,
PickUpLocation: reservation.pickupLocation,
ReturnLocation: reservation.returnLocation,
entryID: i
})
});
i++;
})
this.eventSettings.dataSource = reservationData;
console.log(this.eventSettings.dataSource);
this.isLoading = false;
} catch (error) {
console.log(error);
}
}