diff --git a/source/pages/overview/logic.ts b/source/pages/overview/logic.ts index ad225b4..58b8d54 100644 --- a/source/pages/overview/logic.ts +++ b/source/pages/overview/logic.ts @@ -65,6 +65,13 @@ namespace _zeitbild.frontend_web.pages.overview // weekview { const widget_weekview = new _zeitbild.frontend_web.widgets.weekview.class_widget_weekview( + (from_pit, to_pit, calendar_ids) => _zeitbild.frontend_web.backend.events( + from_pit, + to_pit, + { + "calendar_ids": calendar_ids, + } + ), { "action_select_day": (date) => { lib_plankton.zoo_page.set( diff --git a/source/widgets/weekview/logic.ts b/source/widgets/weekview/logic.ts index 305fd49..effa2f7 100644 --- a/source/widgets/weekview/logic.ts +++ b/source/widgets/weekview/logic.ts @@ -1,11 +1,40 @@ namespace _zeitbild.frontend_web.widgets.weekview { + /** + */ + type type_entry = { + calendar_id : _zeitbild.frontend_web.type.calendar_id; + calendar_name : string; + access_level : _zeitbild.frontend_web.type.enum_access_level; + event_id : (null | _zeitbild.frontend_web.type.local_resource_event_id); + event_object : _zeitbild.frontend_web.type.event_object; + }; + + + /** + */ + type type_get_entries = ( + ( + from_pit : lib_plankton.pit.type_pit, + to_pit : lib_plankton.pit.type_pit, + calendar_ids : Array<_zeitbild.frontend_web.type.calendar_id> + ) + => + Promise> + ); + + /** */ export class class_widget_weekview extends _zeitbild.class_widget { + /** + */ + private get_entries : type_get_entries; + + /** */ private container : (null | Element); @@ -38,6 +67,7 @@ namespace _zeitbild.frontend_web.widgets.weekview /** */ public constructor( + get_entries : type_get_entries, options : { action_select_day ?: ( ( @@ -66,6 +96,7 @@ namespace _zeitbild.frontend_web.widgets.weekview options ); super(); + this.get_entries = get_entries; this.container = null; this.action_select_day = options.action_select_day; this.action_select_event = options.action_select_event; @@ -203,7 +234,7 @@ namespace _zeitbild.frontend_web.widgets.weekview /** * @todo kein "while" */ - private static async calendar_view_table_data( + private async calendar_view_table_data( calendar_ids : ( null | @@ -271,20 +302,10 @@ namespace _zeitbild.frontend_web.widgets.weekview ); // prepare - const entries : Array< - { - calendar_id : _zeitbild.frontend_web.type.calendar_id; - calendar_name : string; - access_level : _zeitbild.frontend_web.type.enum_access_level; - event_id : (null | _zeitbild.frontend_web.type.local_resource_event_id); - event_object : _zeitbild.frontend_web.type.event_object; - } - > = await _zeitbild.frontend_web.backend.events( + const entries : Array = await this.get_entries( from_pit, to_pit, - { - "calendar_ids": calendar_ids, - } + calendar_ids ); let result : { sources : lib_plankton.map.type_map< @@ -523,7 +544,7 @@ namespace _zeitbild.frontend_web.widgets.weekview >; } >; - } = await class_widget_weekview.calendar_view_table_data( + } = await this.calendar_view_table_data( options.calendar_ids, options.from, options.to,