Enhances resource calendar support
Improves resource calendar mode by passing resource data to the grid manager for rendering, enabling specific resource-based views. Also, it stores raw event data to improve data management.
This commit is contained in:
parent
b111f121ba
commit
0b46f68ac1
3 changed files with 28 additions and 2 deletions
|
|
@ -51,12 +51,20 @@ export class CalendarManager {
|
|||
console.log('🚀 CalendarManager: Starting simple initialization');
|
||||
|
||||
try {
|
||||
// Debug: Check calendar type
|
||||
const calendarType = this.config.getCalendarMode();
|
||||
console.log(`🔍 CalendarManager: Initializing ${calendarType} calendar`);
|
||||
|
||||
// Step 1: Load data
|
||||
console.log('📊 Loading event data...');
|
||||
await this.eventManager.loadData();
|
||||
|
||||
// Step 2: Render grid structure
|
||||
// Step 2: Pass data to GridManager and render grid structure
|
||||
console.log('🏗️ Rendering grid...');
|
||||
if (calendarType === 'resource') {
|
||||
const resourceData = this.eventManager.getResourceData();
|
||||
this.gridManager.setResourceData(resourceData);
|
||||
}
|
||||
await this.gridManager.render();
|
||||
|
||||
// Step 3: Initialize scroll synchronization
|
||||
|
|
|
|||
|
|
@ -65,7 +65,8 @@ export class EventManager {
|
|||
const data = await response.json();
|
||||
console.log(`EventManager: Loaded data for ${calendarType} calendar`);
|
||||
|
||||
// Remove legacy double emission - data is sent via StateEvents.DATA_LOADED only
|
||||
// Store raw data for GridManager
|
||||
this.rawData = data;
|
||||
|
||||
// Process data for internal use
|
||||
this.processCalendarData(calendarType, data);
|
||||
|
|
@ -103,6 +104,15 @@ export class EventManager {
|
|||
return [...this.events];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get raw resource data for resource calendar mode
|
||||
*/
|
||||
public getResourceData(): any {
|
||||
return this.rawData;
|
||||
}
|
||||
|
||||
private rawData: any = null;
|
||||
|
||||
|
||||
public getEventById(id: string): CalendarEvent | undefined {
|
||||
return this.events.find(event => event.id === id);
|
||||
|
|
|
|||
|
|
@ -114,6 +114,14 @@ export class GridManager {
|
|||
this.setupGridInteractions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set resource data for resource calendar mode
|
||||
*/
|
||||
public setResourceData(resourceData: ResourceCalendarData | null): void {
|
||||
this.resourceData = resourceData;
|
||||
console.log('GridManager: Set resource data:', resourceData ? `${resourceData.resources.length} resources` : 'null');
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the complete grid structure - now returns Promise for direct calls
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue