From 59f0db9da05209bf411652ee2ac5c5b1e14634ad Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期四, 30 五月 2024 17:07:20 +0800
Subject: [PATCH] 日历不可用事件界面表格

---
 _Main/BL/Type_LibCal_SubscriberEventSearch/_ROOT_Type_LibCal_SubscriberEventSearch.qbl                                                |   10 
 _Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_ListCalendarEventTypes_OnCheckedChanged.def               |   19 +
 _Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelDate_DateSelectorEndTime_OnChanged.def               |    4 
 _Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_PanelDate.def                                            |   14 -
 _Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_listContextMenuCalendarEventTypes.def                    |   10 
 _Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateUpdateEventAndParticipation.def                            |    2 
 _Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_InitializeEventTypes.def                                                 |   17 +
 _Main/BL/Type_LibCal_SubscriberEventTable/StaticMethod_InitializeTable.qbl                                                            |    8 
 _Main/BL/Type_LibCal_CalendarRegistry/_ROOT_Type_LibCal_CalendarRegistry.qbl                                                          |    6 
 _Main/BL/Type_LibCal_SubscriberEventTable/StaticMethod_Export.qbl                                                                     |   66 +++++
 _Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_PanelCalendarUnavailableEvent.def                        |   10 
 _Main/BL/Type_LibCal_EventEvent/_ROOT_Type_LibCal_EventType.qbl                                                                       |    9 
 _Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_InitializeEventTypes.def                                         |   17 +
 _Main/BL/Type_LibCal_CalendarRegistry/Method_GetDefaultEventType.qbl                                                                  |    7 
 _Main/BL/Type_LibCal_EventEvent/StaticMethod_InitializeEventTypes.qbl                                                                 |   14 +
 _Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_CreateUpdateEventAndParticipation.def                                    |    2 
 _Main/BL/Type_LibCal_EventEvent/DefaultValue_Name.qbl                                                                                 |    6 
 _Main/BL/Type_LibCal_SubscriberEventRow/Method_FilterBySubscriberAndEventType.qbl                                                     |    5 
 _Main/BL/Relations/Relation_LibCal_SubscriberEventSearch_MacroPlan_MacroPlan_LibCal_SubscriberE.qbl                                   |   23 +
 _Main/BL/Type_LibCal_Event/StaticMethod_CreateUpdateFromUI.qbl                                                                        |    4 
 _Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Method_InitializeSubscribers.def                                   |    7 
 _Main/BL/Type_LibCal_EventEvent/StaticMethod_GetAvailableTypes.qbl                                                                    |   20 +
 _Main/BL/Type_LibCal_SubscriberEventSearch/Attribute_Start.qbl                                                                        |    7 
 _Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelExport_ButtonHeader_OnClick.def                      |    4 
 _Main/BL/Type_LibCal_SubscriberEventColumn/Method_FilterByDatePeriod.qbl                                                              |    4 
 _Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelPeriods_RadioButtonGroupUseForPlanning_OnChanged.def |    4 
 _Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_CreateEvent#791.def                                                      |   74 ++++++
 _Main/BL/Type_LibCal_EventEvent/Attribute_Name.qbl                                                                                    |    7 
 _Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Component_pnlEventType.def                                                      |   39 ++
 _Main/BL/Type_LibCal_SubscriberEventSearch/Attribute_End.qbl                                                                          |    7 
 _Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_ListCalendarEventTypes.def                               |   42 +++
 _Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_listActionBarPageCalendarEventTypes.def                  |   10 
 _Main/BL/Type_LibCal_EventEvent/StaticMethod_DEFAULT_TYPE.qbl                                                                         |    7 
 _Main/BL/Type_LibCal_EventEvent/Attribute_ID.qbl                                                                                      |    8 
 _Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_MatrixEditorTable.def                                    |    8 
 /dev/null                                                                                                                             |    8 
 _Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_PanelCalendarEventTypes.def                              |   15 +
 _Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateEvent#778.def                                              |    4 
 _Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelExport_ButtonInitialize_OnClick.def                  |    3 
 _Main/BL/Type_LibCal_EventEvent/StaticMethod_Create.qbl                                                                               |   14 +
 _Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_PanelCalendarSearchList.def                              |    2 
 _Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_PanelCalendarUnavailableEventSearchList.def              |    2 
 _Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Component_PanelHeader#144.def                                           |   72 ++++-
 _Main/BL/Relations/Relation_LibCal_EventType_CalendarRegistry_LibCal_CalendarRegistry_EventType.qbl                                   |   23 +
 _Main/BL/Relations/Relation_LibCal_Event_EventType_LibCal_EventType_Event.qbl                                                         |   23 +
 _Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelDate_DateSelectorStartTime_OnChanged.def             |    4 
 _Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeTable.qbl                                                                  |   30 +
 47 files changed, 612 insertions(+), 89 deletions(-)

diff --git a/_Main/BL/Relations/Relation_LibCal_EventType_CalendarRegistry_LibCal_CalendarRegistry_EventType.qbl b/_Main/BL/Relations/Relation_LibCal_EventType_CalendarRegistry_LibCal_CalendarRegistry_EventType.qbl
new file mode 100644
index 0000000..af6742b
--- /dev/null
+++ b/_Main/BL/Relations/Relation_LibCal_EventType_CalendarRegistry_LibCal_CalendarRegistry_EventType.qbl
@@ -0,0 +1,23 @@
+Quintiq file version 2.0
+#parent: #root
+Relation LibCal_EventType_CalendarRegistry_LibCal_CalendarRegistry_EventType
+{
+  #keys: '1[415136.0.714486919]'
+  DefaultRelationStrategy
+  {
+  }
+  RelationSide.LeftSide CalendarRegistry
+  {
+    #keys: '3[415136.0.714486921][415136.0.714486920][415136.0.714486922]'
+    Cardinality: '0to1'
+    ObjectDefinition: LibCal_EventType
+    OwningSide: 'Reference'
+  }
+  RelationSide.RightSide EventType
+  {
+    #keys: '3[415136.0.714486924][415136.0.714486923][415136.0.714486925]'
+    Cardinality: '1toN'
+    ObjectDefinition: LibCal_CalendarRegistry
+    OwningSide: 'Owned'
+  }
+}
diff --git a/_Main/BL/Relations/Relation_LibCal_Event_EventType_LibCal_EventType_Event.qbl b/_Main/BL/Relations/Relation_LibCal_Event_EventType_LibCal_EventType_Event.qbl
new file mode 100644
index 0000000..eee139f
--- /dev/null
+++ b/_Main/BL/Relations/Relation_LibCal_Event_EventType_LibCal_EventType_Event.qbl
@@ -0,0 +1,23 @@
+Quintiq file version 2.0
+#parent: #root
+Relation LibCal_Event_EventType_LibCal_EventType_Event
+{
+  #keys: '1[415136.0.714487004]'
+  DefaultRelationStrategy
+  {
+  }
+  RelationSide.LeftSide EventType
+  {
+    #keys: '3[415136.0.714487006][415136.0.714487005][415136.0.714487007]'
+    Cardinality: '0to1'
+    ObjectDefinition: LibCal_Event
+    OwningSide: 'Reference'
+  }
+  RelationSide.RightSide Event
+  {
+    #keys: '3[415136.0.714487009][415136.0.714487008][415136.0.714487010]'
+    Cardinality: '1toN'
+    ObjectDefinition: LibCal_EventType
+    OwningSide: 'Reference'
+  }
+}
diff --git a/_Main/BL/Relations/Relation_LibCal_SubscriberEventSearch_MacroPlan_MacroPlan_LibCal_SubscriberE.qbl b/_Main/BL/Relations/Relation_LibCal_SubscriberEventSearch_MacroPlan_MacroPlan_LibCal_SubscriberE.qbl
new file mode 100644
index 0000000..6eacfff
--- /dev/null
+++ b/_Main/BL/Relations/Relation_LibCal_SubscriberEventSearch_MacroPlan_MacroPlan_LibCal_SubscriberE.qbl
@@ -0,0 +1,23 @@
+Quintiq file version 2.0
+#parent: #root
+Relation LibCal_SubscriberEventSearch_MacroPlan_MacroPlan_LibCal_SubscriberEventSearch
+{
+  #keys: '1[415136.0.703300877]'
+  DefaultRelationStrategy
+  {
+  }
+  RelationSide.LeftSide MacroPlan
+  {
+    #keys: '3[415136.0.703300879][415136.0.703300878][415136.0.703300880]'
+    Cardinality: '0to1'
+    ObjectDefinition: LibCal_SubscriberEventSearch
+    OwningSide: 'Reference'
+  }
+  RelationSide.RightSide LibCal_SubscriberEventSearch
+  {
+    #keys: '3[415136.0.703300882][415136.0.703300881][415136.0.703300883]'
+    Cardinality: '0to1'
+    ObjectDefinition: MacroPlan
+    OwningSide: 'Owned'
+  }
+}
diff --git a/_Main/BL/Type_LibCal_CalendarRegistry/Method_GetDefaultEventType.qbl b/_Main/BL/Type_LibCal_CalendarRegistry/Method_GetDefaultEventType.qbl
new file mode 100644
index 0000000..fad2ea2
--- /dev/null
+++ b/_Main/BL/Type_LibCal_CalendarRegistry/Method_GetDefaultEventType.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Method GetDefaultEventType () remote as LibCal_EventType
+{
+  Description: '鑾峰彇榛樿浜嬩欢绫诲瀷'
+  TextBody: 'return select( this, EventType, type, true, type.Name() = LibCal_EventType::DEFAULT_TYPE() );'
+}
diff --git a/_Main/BL/Type_LibCal_CalendarRegistry/_ROOT_Type_LibCal_CalendarRegistry.qbl b/_Main/BL/Type_LibCal_CalendarRegistry/_ROOT_Type_LibCal_CalendarRegistry.qbl
new file mode 100644
index 0000000..299abba
--- /dev/null
+++ b/_Main/BL/Type_LibCal_CalendarRegistry/_ROOT_Type_LibCal_CalendarRegistry.qbl
@@ -0,0 +1,6 @@
+Quintiq file version 2.0
+#root
+#parent: #DomainModel
+Type LibCal_CalendarRegistry #extension
+{
+}
diff --git a/_Main/BL/Type_LibCal_Event/Attribute_EventType.qbl b/_Main/BL/Type_LibCal_Event/Attribute_EventType.qbl
deleted file mode 100644
index a55e723..0000000
--- a/_Main/BL/Type_LibCal_Event/Attribute_EventType.qbl
+++ /dev/null
@@ -1,8 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Attribute EventType
-{
-  #keys: '3[415136.0.658372336][415136.0.658372335][415136.0.658372337]'
-  Description: '浜嬩欢绫诲瀷'
-  ValueType: String
-}
diff --git a/_Main/BL/Type_LibCal_Event/StaticMethod_CreateUpdateFromUI.qbl b/_Main/BL/Type_LibCal_Event/StaticMethod_CreateUpdateFromUI.qbl
index 14da6c2..812c8aa 100644
--- a/_Main/BL/Type_LibCal_Event/StaticMethod_CreateUpdateFromUI.qbl
+++ b/_Main/BL/Type_LibCal_Event/StaticMethod_CreateUpdateFromUI.qbl
@@ -6,7 +6,7 @@
   String subject_i,
   String description_i,
   String type_i,
-  String eventtype_i,
+  LibCal_EventType eventtype_i,
   Real capacity_i,
   LibCal_EventCategory category_i,
   Boolean isDefault_i,
@@ -47,7 +47,7 @@
                                       patternYearly_IsDate_i, patternYearly_Month_i, patternYearly_Day_i, patternYearly_WeekOfMonth_i, patternYearly_DayOfWeek_i,
                                       periodType_i, periodStartDate_i, nrOfOccurrences_i, periodEndDate_i, subscribers_i );
     
-    event.EventType( eventtype_i );
+    event.EventType( relset, eventtype_i );
     
     return event;
   *]
diff --git a/_Main/BL/Type_LibCal_EventEvent/Attribute_ID.qbl b/_Main/BL/Type_LibCal_EventEvent/Attribute_ID.qbl
new file mode 100644
index 0000000..49d86c9
--- /dev/null
+++ b/_Main/BL/Type_LibCal_EventEvent/Attribute_ID.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute ID
+{
+  #keys: '3[415136.0.714581728][415136.0.714581727][415136.0.714581729]'
+  IsReadOnly: true
+  ValueType: String
+}
diff --git a/_Main/BL/Type_LibCal_EventEvent/Attribute_Name.qbl b/_Main/BL/Type_LibCal_EventEvent/Attribute_Name.qbl
new file mode 100644
index 0000000..f951bf7
--- /dev/null
+++ b/_Main/BL/Type_LibCal_EventEvent/Attribute_Name.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute Name
+{
+  #keys: '3[415136.0.714581709][415136.0.714581708][415136.0.714581710]'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_LibCal_EventEvent/DefaultValue_Name.qbl b/_Main/BL/Type_LibCal_EventEvent/DefaultValue_Name.qbl
new file mode 100644
index 0000000..86c3d59
--- /dev/null
+++ b/_Main/BL/Type_LibCal_EventEvent/DefaultValue_Name.qbl
@@ -0,0 +1,6 @@
+Quintiq file version 2.0
+#parent: #root
+DefaultValue
+{
+  TargetAttribute: Name
+}
diff --git a/_Main/BL/Type_LibCal_EventEvent/StaticMethod_Create.qbl b/_Main/BL/Type_LibCal_EventEvent/StaticMethod_Create.qbl
new file mode 100644
index 0000000..686ee68
--- /dev/null
+++ b/_Main/BL/Type_LibCal_EventEvent/StaticMethod_Create.qbl
@@ -0,0 +1,14 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod Create (
+  LibCal_CalendarRegistry owner_i,
+  String categoryName_i
+) as LibCal_EventType
+{
+  Description: '鍒涘缓'
+  TextBody:
+  [*
+    return owner_i.EventType( relnew,ID := categoryName_i,
+                                  Name := categoryName_i );
+  *]
+}
diff --git a/_Main/BL/Type_LibCal_EventEvent/StaticMethod_DEFAULT_TYPE.qbl b/_Main/BL/Type_LibCal_EventEvent/StaticMethod_DEFAULT_TYPE.qbl
new file mode 100644
index 0000000..0135391
--- /dev/null
+++ b/_Main/BL/Type_LibCal_EventEvent/StaticMethod_DEFAULT_TYPE.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod DEFAULT_TYPE () const declarative remote as String
+{
+  Description: 'Can be extended to define the name of the general EventCategory, which will always be created.'
+  TextBody: 'return "绔崍鑺�";'
+}
diff --git a/_Main/BL/Type_LibCal_EventEvent/StaticMethod_GetAvailableTypes.qbl b/_Main/BL/Type_LibCal_EventEvent/StaticMethod_GetAvailableTypes.qbl
new file mode 100644
index 0000000..81fd963
--- /dev/null
+++ b/_Main/BL/Type_LibCal_EventEvent/StaticMethod_GetAvailableTypes.qbl
@@ -0,0 +1,20 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GetAvailableTypes () as owning Strings
+{
+  Description: 'Can be extended to return the applicable available EventCategories, in addition to the general category that will always be generated.'
+  TextBody:
+  [*
+    categories := construct( Strings );
+    
+    // By default there is an EventCategory for each of the EventTypes.
+    // This method can be extended in order to have other available EventCategories.
+    // A general category will always be added automatically.
+    categories.Add( '鍔冲姩鑺�' );
+    categories.Add( '绔崍鑺�' );
+    categories.Add( '鍥藉簡鑺�' );
+    categories.Add( '涓鑺�' );
+    
+    return &categories;
+  *]
+}
diff --git a/_Main/BL/Type_LibCal_EventEvent/StaticMethod_InitializeEventTypes.qbl b/_Main/BL/Type_LibCal_EventEvent/StaticMethod_InitializeEventTypes.qbl
new file mode 100644
index 0000000..debde60
--- /dev/null
+++ b/_Main/BL/Type_LibCal_EventEvent/StaticMethod_InitializeEventTypes.qbl
@@ -0,0 +1,14 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod InitializeEventTypes (
+  LibCal_CalendarRegistry registry_i
+)
+{
+  TextBody:
+  [*
+    traverse( LibCal_EventType::GetAvailableTypes(), Elements, type )
+    {
+      LibCal_EventType::Create( registry_i, type );
+    }
+  *]
+}
diff --git a/_Main/BL/Type_LibCal_EventEvent/_ROOT_Type_LibCal_EventType.qbl b/_Main/BL/Type_LibCal_EventEvent/_ROOT_Type_LibCal_EventType.qbl
new file mode 100644
index 0000000..b9def67
--- /dev/null
+++ b/_Main/BL/Type_LibCal_EventEvent/_ROOT_Type_LibCal_EventType.qbl
@@ -0,0 +1,9 @@
+Quintiq file version 2.0
+#root
+#parent: #DomainModel
+Type LibCal_EventType
+{
+  #keys: '5[415136.0.714581706][415136.0.714581704][0.0.0][415136.0.714581705][415136.0.714581707]'
+  BaseType: Object
+  StructuredName: 'LibCal_EventTypes'
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventColumn/Method_FilterByDatePeriod.qbl b/_Main/BL/Type_LibCal_SubscriberEventColumn/Method_FilterByDatePeriod.qbl
index ae7bf3d..f0e5182 100644
--- a/_Main/BL/Type_LibCal_SubscriberEventColumn/Method_FilterByDatePeriod.qbl
+++ b/_Main/BL/Type_LibCal_SubscriberEventColumn/Method_FilterByDatePeriod.qbl
@@ -9,8 +9,8 @@
   [*
     // 鐢勫叞楦� May-29-2024 (created)
     value := false;
-    info( this.Index(), this.Period(), start, end );
-    if( this.Index() < 2  ){
+    //info( this.Index(), this.LibCal_SubscriberEventTable().Name(), this.Period(), start, end );
+    if( this.Index() < 2 or ( this.Period() >= start and this.Period() <= end ) ){
         value := true;
     }
     
diff --git a/_Main/BL/Type_LibCal_SubscriberEventRow/Method_FilterBySubscriberAndEventType.qbl b/_Main/BL/Type_LibCal_SubscriberEventRow/Method_FilterBySubscriberAndEventType.qbl
index 10b43b0..bda8fc9 100644
--- a/_Main/BL/Type_LibCal_SubscriberEventRow/Method_FilterBySubscriberAndEventType.qbl
+++ b/_Main/BL/Type_LibCal_SubscriberEventRow/Method_FilterBySubscriberAndEventType.qbl
@@ -1,14 +1,15 @@
 Quintiq file version 2.0
 #parent: #root
 Method FilterBySubscriberAndEventType (
-  LibCal_Calendars subscribers
+  LibCal_Calendars subscribers,
+  LibCal_EventTypes eventtypes
 ) declarative remote as Boolean
 {
   TextBody:
   [*
     // 鐢勫叞楦� May-29-2024 (created)
     value := false;
-    if( exists( subscribers, Elements, e, e.CalendarID() = this.Subscriber() ) ){
+    if( exists( subscribers, Elements, e, e.CalendarID() = this.Subscriber() ) and exists( eventtypes, Elements, e, e.Name() = this.EventType() ) ){
       value := true;
     }
     
diff --git a/_Main/BL/Type_LibCal_SubscriberEventSearch/Attribute_End.qbl b/_Main/BL/Type_LibCal_SubscriberEventSearch/Attribute_End.qbl
new file mode 100644
index 0000000..734215b
--- /dev/null
+++ b/_Main/BL/Type_LibCal_SubscriberEventSearch/Attribute_End.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute End
+{
+  #keys: '3[415136.0.703300868][415136.0.703300867][415136.0.703300869]'
+  ValueType: Date
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventSearch/Attribute_Start.qbl b/_Main/BL/Type_LibCal_SubscriberEventSearch/Attribute_Start.qbl
new file mode 100644
index 0000000..1c48610
--- /dev/null
+++ b/_Main/BL/Type_LibCal_SubscriberEventSearch/Attribute_Start.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute Start
+{
+  #keys: '3[415136.0.703300858][415136.0.703300857][415136.0.703300859]'
+  ValueType: Date
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventSearch/_ROOT_Type_LibCal_SubscriberEventSearch.qbl b/_Main/BL/Type_LibCal_SubscriberEventSearch/_ROOT_Type_LibCal_SubscriberEventSearch.qbl
new file mode 100644
index 0000000..0084fa7
--- /dev/null
+++ b/_Main/BL/Type_LibCal_SubscriberEventSearch/_ROOT_Type_LibCal_SubscriberEventSearch.qbl
@@ -0,0 +1,10 @@
+Quintiq file version 2.0
+#root
+#parent: #DomainModel
+Type LibCal_SubscriberEventSearch
+{
+  #keys: '5[415136.0.703300854][415136.0.703300852][0.0.0][415136.0.703300853][415136.0.703300855]'
+  BaseType: Object
+  Description: '鏃ュ巻涓嶅彲鐢ㄤ簨浠剁晫闈㈡煡璇㈡潯浠�'
+  StructuredName: 'LibCal_SubscriberEventSearchs'
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeTable.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeTable.qbl
index 61af153..6ef690d 100644
--- a/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeTable.qbl
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeTable.qbl
@@ -1,8 +1,7 @@
 Quintiq file version 2.0
 #parent: #root
 Method InitializeTable (
-  LibCal_Calendars subscribers,
-  LibCal_EventCategory category
+  LibCal_Calendars subscribers
 )
 {
   TextBody:
@@ -22,17 +21,23 @@
     traverse( subscribers, Elements, subscriber ){
     //  info( '------------------------', subscriber.CalendarID(), subscriber.CalendarType() );
     //  traverse( subscriber,Participation.astype( LibCal_Subscription ).LeadingParticipation, participation ){
-      traverse( subscriber,Participation.astype( LibCal_Subscription ).LeadingParticipation, participation, participation.Event().EventCategory() = category ){
+      traverse( subscriber,Participation.astype( LibCal_Subscription ).LeadingParticipation, participation, participation.Event().EventCategory().Name() = 'Unavailable' ){
     //    info( '------------------------', participation.Event().Subject(), '------', participation.Event().EventCategory().Name() );
         event := participation.Event();
-        row := selectobject( this, LibCal_SubscriberEventRow, row, row.Subscriber() = subscriber.CalendarID() and row.Event() = event.Subject() and row.EventType() = event.EventType() );
+        row := selectobject( this, LibCal_SubscriberEventRow, row, row.Subscriber() = subscriber.CalendarID() 
+                             and row.Event() = event.Subject() 
+                             and row.EventType() = event.EventType().Name() 
+                             );
         if( isnull( row ) ){
-          row := this.LibCal_SubscriberEventRow( relnew, RowNr := rownr, Subscriber := subscriber.CalendarID(), Event := event.Subject(), EventType := event.EventType() );
+          row := this.LibCal_SubscriberEventRow( relnew, RowNr := rownr, Subscriber := subscriber.CalendarID(), 
+                                                 Event := event.Subject(), 
+                                                 EventType := event.EventType().Name() );
           
-          if( counter( this, LibCal_SubscriberEventRow, linerow, linerow.Subscriber() = row.Subscriber() ) = 1 ){
-            subscribercell := subscribercolumn.LibCal_SubscriberEventCell( relnew, Value := row.Subscriber() );
-            row.LibCal_SubscriberEventCell( relinsert, subscribercell );
+          subscribercell := subscribercolumn.LibCal_SubscriberEventCell( relnew, Value := row.Subscriber() );
+          if( counter( this, LibCal_SubscriberEventRow, linerow, linerow.Subscriber() = row.Subscriber() ) <> 1 ){
+            subscribercell.Value( '' );
           }
+          row.LibCal_SubscriberEventCell( relinsert, subscribercell );
           
           eventcell := eventcolumn.LibCal_SubscriberEventCell( relnew, Value := row.Event() );
           row.LibCal_SubscriberEventCell( relinsert, eventcell );
@@ -52,5 +57,14 @@
     
       }
     }
+    
+    traverse( this, LibCal_SubscriberEventColumn, column ){
+      traverse( this, LibCal_SubscriberEventRow, row ){
+        if( not exists( column, LibCal_SubscriberEventCell, cell, cell.LibCal_SubscriberEventRow() = row ) ) {
+          cell := column.LibCal_SubscriberEventCell( relnew, Value := '' );
+          row.LibCal_SubscriberEventCell( relinsert, cell );
+        }
+      }
+    }
   *]
 }
diff --git a/_Main/BL/Type_LibCal_SubscriberEventTable/StaticMethod_Export.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/StaticMethod_Export.qbl
new file mode 100644
index 0000000..77d0846
--- /dev/null
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/StaticMethod_Export.qbl
@@ -0,0 +1,66 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod Export (
+  LibCal_SubscriberEventTable table
+) as BinaryValue
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� May-30-2024 (created)
+    // lihongji Jun-8-2023 (created)
+    returnBinaryData := BinaryData::Construct();
+    tableGroupHandle := TableGroupHandle::Create( "" );
+    
+    xmlImpl := XMLDOMImplementation::Create();
+    xmlDoc := xmlImpl.CreateDocument();
+    xmlSeri := xmlImpl.CreateSerializer();
+      
+    xmlTable := xmlDoc.CreateElement( "table" );
+    xmlTableName := xmlDoc.CreateElement( "name" );
+    xmlTableName.TextContent( table.Name() );
+    xmlTable.AppendChild( xmlTableName );
+      
+    traverse ( table, LibCal_SubscriberEventColumn, column ) {
+      xmlColumn := xmlDoc.CreateElement( "column" );
+      xmlColumnName := xmlDoc.CreateElement( "name" );
+      if( column.Index() = 0 ){
+        xmlColumnName.TextContent( '浜х嚎' );
+      }else if(column.Index() = 1 ){
+        xmlColumnName.TextContent( '浜嬩欢' );
+      }else{
+        xmlColumnName.TextContent( column.Name() );
+      }
+      xmlColumn.AppendChild( xmlColumnName );
+      xmlColumnType := xmlDoc.CreateElement( "type" );
+      xmlColumnType.TextContent( "String" );
+      xmlColumn.AppendChild( xmlColumnType );
+      
+      rowTotal := table.LibCal_SubscriberEventRow( relsize );
+      for ( i := 0; i < rowTotal; i++ ) {
+        cell := select( column, LibCal_SubscriberEventCell, cell, cell.LibCal_SubscriberEventRow().RowNr() = i );
+        row := cell.LibCal_SubscriberEventRow();
+        xmlCell := xmlDoc.CreateElement( "cell" );
+        if( column.Index() = 0 ){
+          xmlCell.SetAttribute( "value", row.Subscriber() );
+        }else if(column.Index() = 1 ){
+          xmlCell.SetAttribute( "value", row.Event() );
+        }else{
+          xmlCell.SetAttribute( "value", cell.Value() );
+        }
+        xmlColumn.AppendChild( xmlCell );
+      }
+        
+      xmlTable.AppendChild( xmlColumn );
+    }
+      
+    xmlDoc.AppendChild( xmlTable );
+    xmlStr := xmlSeri.WriteToString( xmlDoc );
+    tableHandle := TableHandle::ImportXML( BinaryValue::Construct( xmlStr ) );
+    tableGroupHandle.Add( tableHandle );
+    //}
+    
+    returnBinaryData := XLS::SaveTableGroupToBinaryData( tableGroupHandle, true );
+    
+    return returnBinaryData.AsBinaryValue();
+  *]
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventTable/StaticMethod_InitializeTable.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/StaticMethod_InitializeTable.qbl
index bbeff88..f6e41d1 100644
--- a/_Main/BL/Type_LibCal_SubscriberEventTable/StaticMethod_InitializeTable.qbl
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/StaticMethod_InitializeTable.qbl
@@ -2,21 +2,21 @@
 #parent: #root
 StaticMethod InitializeTable (
   LibCal_Calendars subscribers,
-  LibCal_Calendar owner,
-  LibCal_EventCategory category
+  LibCal_Calendar owner
 )
 {
   TextBody:
   [*
     // 鐢勫叞楦� May-28-2024 (created)
+    owner.LibCal_SubscriberEventTable( relflush );
     if( owner.LibCal_SubscriberEventTable( relsize ) < 1 ){
       owner.LibCal_SubscriberEventTable( relnew, ID := 'Day', Name := 'Day' );
       owner.LibCal_SubscriberEventTable( relnew, ID := 'Week', Name := 'Week' );
       owner.LibCal_SubscriberEventTable( relnew, ID := 'Month', Name := 'Month' );
     }
-    info('-----------------------------', owner.LibCal_SubscriberEventTable( relsize ), subscribers.Size(), isnull( category ) );
+    info('-----------------------------', owner.LibCal_SubscriberEventTable( relsize ), subscribers.Size() );
     traverse( owner, LibCal_SubscriberEventTable, table ){
-      table.InitializeTable( subscribers, category );
+      table.InitializeTable( subscribers );
     }
   *]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_ListCalendarEventTypes.def b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_ListCalendarEventTypes.def
new file mode 100644
index 0000000..b241133
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_ListCalendarEventTypes.def
@@ -0,0 +1,42 @@
+Quintiq file version 2.0
+Component ListCalendarEventTypes
+{
+  #keys: '[415136.0.714793803]'
+  BaseType: 'WebList'
+  Children:
+  [
+    Component DataExtractorCalendarEventTypes
+    {
+      #keys: '[415136.0.714793804]'
+      BaseType: 'WebDataExtractor'
+      Properties:
+      [
+        DataType: 'LibCal_CalendarRegistry'
+        Source: 'LibCal_GlobalState.dhGlobalCalendarRegistry'
+        Taborder: 0
+        Transformation: 'EventType'
+      ]
+    }
+    #child: listActionBarPageCalendarEventTypes
+    Component DataSetLevelCalendarEventTypes
+    {
+      #keys: '[415136.0.714793809]'
+      BaseType: 'WebDataSetLevel'
+      Children:
+      [
+        #child: listContextMenuCalendarEventTypes
+      ]
+      Properties:
+      [
+        Columns: '[{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Name","title":"Name","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Name"}}]'
+        ContextMenu: 'listContextMenuCalendarEventTypes'
+        Taborder: 2
+      ]
+    }
+  ]
+  Properties:
+  [
+    SelectionCheckboxes: true
+    Taborder: 1
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_MatrixEditorTable.def b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_MatrixEditorTable.def
index 4a8f9f1..fdee85e 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_MatrixEditorTable.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_MatrixEditorTable.def
@@ -45,8 +45,8 @@
           Properties:
           [
             DataType: 'LibCal_SubscriberEventTable'
-            FilterArguments: 'subscribers:dhSubscribers'
-            FixedFilter: 'object.FilterBySubscriberAndEventType( subscribers )'
+            FilterArguments: 'subscribers:dhSubscribers;eventtypes:dhEventTypes'
+            FixedFilter: 'object.FilterBySubscriberAndEventType( subscribers, eventtypes )'
             Source: 'dhTable'
             Taborder: 0
             Transformation: 'LibCal_SubscriberEventRow'
@@ -73,7 +73,9 @@
           Properties:
           [
             DataType: 'LibCal_SubscriberEventTable'
-            FilterArguments: 'starttime:dhStartDate;endtime:dhEndDate'
+            Description: 'object.FilterByDatePeriod( Date::MinDate(), Date::MaxDate() )'
+            FilterArguments: 'period:dhDate'
+            FixedFilter: 'object.FilterByDatePeriod( period.Start(), period.End() )'
             Source: 'dhTable'
             Taborder: 0
             Transformation: 'LibCal_SubscriberEventColumn'
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_PanelCalendarEventTypes.def b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_PanelCalendarEventTypes.def
index dfbdbdc..243ef2a 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_PanelCalendarEventTypes.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_PanelCalendarEventTypes.def
@@ -3,10 +3,25 @@
 {
   #keys: '[415136.0.658772868]'
   BaseType: 'WebPanel'
+  Children:
+  [
+    #child: ListCalendarEventTypes
+    Component dhEventTypes
+    {
+      #keys: '[415136.0.714794191]'
+      BaseType: 'WebDataHolder'
+      Databinding: 'structured[LibCal_EventType]*'
+      Properties:
+      [
+        Taborder: 0
+      ]
+    }
+  ]
   Properties:
   [
     FixedSize: true
     MinimumColumns: 39
     Taborder: 1
+    Title: 'Event type'
   ]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_PanelCalendarSearchList.def b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_PanelCalendarSearchList.def
index 46c190a..69ccc53 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_PanelCalendarSearchList.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_PanelCalendarSearchList.def
@@ -12,6 +12,6 @@
   [
     FixedSize: true
     Orientation: 'horizontal'
-    Taborder: 2
+    Taborder: 1
   ]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_PanelCalendarUnavailableEvent.def b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_PanelCalendarUnavailableEvent.def
index 907d686..d6cd611 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_PanelCalendarUnavailableEvent.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_PanelCalendarUnavailableEvent.def
@@ -32,16 +32,6 @@
         Taborder: 0
       ]
     }
-    Component dhCategory
-    {
-      #keys: '[415136.0.701811642]'
-      BaseType: 'WebDataHolder'
-      Databinding: 'LibCal_EventCategory'
-      Properties:
-      [
-        Taborder: 1
-      ]
-    }
   ]
   Properties:
   [
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_PanelCalendarUnavailableEventSearchList.def b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_PanelCalendarUnavailableEventSearchList.def
index eedf788..d06d6c3 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_PanelCalendarUnavailableEventSearchList.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_PanelCalendarUnavailableEventSearchList.def
@@ -10,6 +10,6 @@
   ]
   Properties:
   [
-    Taborder: 3
+    Taborder: 2
   ]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_PanelDate.def b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_PanelDate.def
index 72e7e87..4f9ef52 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_PanelDate.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_PanelDate.def
@@ -26,24 +26,14 @@
         Taborder: 1
       ]
     }
-    Component dhStartDate id:dhStartDate_529
+    Component dhDate
     {
       #keys: '[415136.0.701820404]'
       BaseType: 'WebDataHolder'
-      Databinding: 'Date'
+      Databinding: 'LibCal_SubscriberEventSearch'
       Properties:
       [
         Taborder: 2
-      ]
-    }
-    Component dhEndDate id:dhEndDate_480
-    {
-      #keys: '[415136.0.701820426]'
-      BaseType: 'WebDataHolder'
-      Databinding: 'Date'
-      Properties:
-      [
-        Taborder: 3
       ]
     }
   ]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_listActionBarPageCalendarEventTypes.def b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_listActionBarPageCalendarEventTypes.def
new file mode 100644
index 0000000..e67eca8
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_listActionBarPageCalendarEventTypes.def
@@ -0,0 +1,10 @@
+Quintiq file version 2.0
+Component listActionBarPageCalendarEventTypes
+{
+  #keys: '[415136.0.714793806]'
+  BaseType: 'listActionBarPage'
+  Properties:
+  [
+    Taborder: 1
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_listContextMenuCalendarEventTypes.def b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_listContextMenuCalendarEventTypes.def
new file mode 100644
index 0000000..227183a
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_listContextMenuCalendarEventTypes.def
@@ -0,0 +1,10 @@
+Quintiq file version 2.0
+Component listContextMenuCalendarEventTypes
+{
+  #keys: '[415136.0.714793811]'
+  BaseType: 'listContextMenu'
+  Properties:
+  [
+    Taborder: 0
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Method_InitializeSubscribers.def b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Method_InitializeSubscribers.def
index cdc74a7..77ef126 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Method_InitializeSubscribers.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Method_InitializeSubscribers.def
@@ -5,9 +5,10 @@
   #keys: '[415136.0.666291565]'
   Body:
   [*
+    
     owner_i := LibCal_GlobalState.dhGlobalCalendarRegistry().Data().CommonCalendar();
+    
     category_i := selectobject( owner_i,CalendarRegistry.EventCategory, category, category.Name() = 'Unavaliable' );
-    dhCategory.Data(category_i);
     
     sEvent := owner_i.Event( relshadow,
                              EventID        := [String]Key::NextPersistentKey(),
@@ -25,6 +26,9 @@
     calendar             := sLeadPart.Calendar();
     potentialSubscribers := calendar.GetPotentialSubscribers();
     
+    period := MacroPlan.LibCal_SubscriberEventSearch( relnew, Start := Date::MinDate(), End := Date::MaxDate() );
+    
+    dhDate.Data( period );
     // Remove the calendar of the initiator (cannot subscribe to self).
     initiator := sEvent.Calendar();
     if( potentialSubscribers.Find( initiator ) >= 0 )
@@ -35,5 +39,6 @@
     dhPotentialSubscribers.Data( &potentialSubscribers );
     
     lstSubscribers.CheckAll();
+    ListCalendarEventTypes.CheckAll();
   *]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_ListCalendarEventTypes_OnCheckedChanged.def b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_ListCalendarEventTypes_OnCheckedChanged.def
new file mode 100644
index 0000000..50b0cb4
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_ListCalendarEventTypes_OnCheckedChanged.def
@@ -0,0 +1,19 @@
+Quintiq file version 2.0
+#parent: ListCalendarEventTypes
+Response OnCheckedChanged (
+  structured[LibCal_EventType] checkeditems
+) id:Response_ListCalendarEventTypes_OnCheckedChanged
+{
+  #keys: '[415136.0.714794303]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebList_OnCheckedChanged'
+  QuillAction
+  {
+    Body:
+    [*
+      enventtypes := checkeditems.Copy();
+      dhEventTypes.Data( &enventtypes );
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelDate_DateSelectorEndTime_OnChanged.def b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelDate_DateSelectorEndTime_OnChanged.def
index 4e64dd2..eed1c2b 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelDate_DateSelectorEndTime_OnChanged.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelDate_DateSelectorEndTime_OnChanged.def
@@ -9,7 +9,9 @@
   {
     Body:
     [*
-      dhEndDate.Data(this.Date());
+      period := dhDate.Data();
+      period.End( this.Date() );
+      dhDate.Data( period );
     *]
     GroupServerCalls: false
   }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelDate_DateSelectorStartTime_OnChanged.def b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelDate_DateSelectorStartTime_OnChanged.def
index d99c1d8..5a47dfa 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelDate_DateSelectorStartTime_OnChanged.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelDate_DateSelectorStartTime_OnChanged.def
@@ -9,7 +9,9 @@
   {
     Body:
     [*
-      dhStartDate.Data(this.Date());
+      period := dhDate.Data();
+      period.Start( this.Date() );
+      dhDate.Data( period );
     *]
     GroupServerCalls: false
   }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelExport_ButtonHeader_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelExport_ButtonHeader_OnClick.def
index d5d9e0a..73a9922 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelExport_ButtonHeader_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelExport_ButtonHeader_OnClick.def
@@ -9,7 +9,9 @@
   {
     Body:
     [*
-      info( '--------------------------------', dhStartDate.Data(), dhEndDate.Data() )
+      binaryValue := LibCal_SubscriberEventTable::Export( dhTable.Data() );
+      
+      Application.Download( "Unavailable events.xlsx", binaryValue.AsBinaryData() );
     *]
     GroupServerCalls: false
   }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelExport_ButtonInitialize_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelExport_ButtonInitialize_OnClick.def
index e275403..49d35f4 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelExport_ButtonInitialize_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelExport_ButtonInitialize_OnClick.def
@@ -9,7 +9,8 @@
   {
     Body:
     [*
-      LibCal_SubscriberEventTable::InitializeTable( dhPotentialSubscribers.Data(), dhCalendar.Data(), dhCategory.Data() );
+      //鍒濆鍖栨暟鎹�
+      LibCal_SubscriberEventTable::InitializeTable( dhPotentialSubscribers.Data(), dhCalendar.Data() );
     *]
     GroupServerCalls: false
   }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelPeriods_RadioButtonGroupUseForPlanning_OnChanged.def b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelPeriods_RadioButtonGroupUseForPlanning_OnChanged.def
index 833c721..29c6ed7 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelPeriods_RadioButtonGroupUseForPlanning_OnChanged.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelPeriods_RadioButtonGroupUseForPlanning_OnChanged.def
@@ -9,9 +9,9 @@
   {
     Body:
     [*
-      owner_i := LibCal_GlobalState.dhGlobalCalendarRegistry().Data().CommonCalendar();
+      owner_i := dhCalendar.Data();
       if( owner_i.LibCal_SubscriberEventTable( relsize ) < 1 ){
-        LibCal_SubscriberEventTable::InitializeTable( dhPotentialSubscribers.Data(), dhCalendar.Data(), dhCategory.Data() );
+        LibCal_SubscriberEventTable::InitializeTable( dhPotentialSubscribers.Data(), dhCalendar.Data() );
       }
       table := selectobject( owner_i, LibCal_SubscriberEventTable, table, table.ID() = this.BoundValue() );
       
diff --git a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Component_pnlEventType.def b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Component_pnlEventType.def
index 76366d7..5fd5ae7 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Component_pnlEventType.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Component_pnlEventType.def
@@ -13,17 +13,46 @@
       [
         Label: 'Event type'
         NumberOfColumns: 0
+        Taborder: 1
+      ]
+    }
+    Component dhEventTypes
+    {
+      #keys: '[415136.0.705611943]'
+      BaseType: 'WebDataHolder'
+      Databinding: 'structured[LibCal_EventType]*'
+      Properties:
+      [
         Taborder: 0
       ]
     }
-    Component edtEventType
+    Component ddlEventType
     {
-      #keys: '[415136.0.657922077]'
-      BaseType: 'WebEditField'
+      #keys: '[415136.0.705611783]'
+      BaseType: 'WebDropDownList'
+      Databinding: 'LibCal_EventType'
+      Children:
+      [
+        Component deEventType
+        {
+          #keys: '[415136.0.705611784]'
+          BaseType: 'WebDataExtractor'
+          Properties:
+          [
+            DataType: 'structured[LibCal_EventType]'
+            Source: 'dhEventTypes'
+            Taborder: 0
+            Transformation: 'Elements'
+          ]
+        }
+      ]
       Properties:
       [
-        DataBinding: 'dhEvent.Data.EventType'
-        Taborder: 1
+        Description: 'dhEvent.Data.EventType'
+        DisplayField: 'Name'
+        NumberOfColumns: 15
+        ShowLabel: false
+        Taborder: 2
       ]
     }
   ]
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_CreateEvent\043791.def" "b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_CreateEvent\043791.def"
new file mode 100644
index 0000000..a775035
--- /dev/null
+++ "b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_CreateEvent\043791.def"
@@ -0,0 +1,74 @@
+Quintiq file version 2.0
+#parent: #root
+Method CreateEvent (
+  LibCal_Calendar owner_i,
+  LibCal_EventCategory category_i,
+  DateTime start_i,
+  DateTime end_i
+) id:Method_LibCal_dlgEvent_CreateEvent_791 #extension
+{
+  Body:
+  [*
+    timezone := owner_i.GetTimeZone();
+    
+    // Create a new Event...
+    sEvent := owner_i.Event( relshadow,
+                             EventID        := [String]Key::NextPersistentKey(),
+                             StartTimeOfDay := start_i.TimeOfDay( timezone ),
+                             EndTimeOfDay   := end_i  .TimeOfDay( timezone ),
+                             EventCategory  := category_i,
+                             IsDefault      := owner_i.istype( LibCal_CommonCalendar ) );
+    
+    // Special case: by default the EventType is 'Unavailable', but when an event is created for
+    // category 'Available' or 'Partial' then set the Type to 'Available' resp 'Partial'. 
+    if( guard( category_i.Name() = LibCal_Event::TYPE_AVAILABLE(), false ) )
+    {
+      sEvent.Type( LibCal_Event::TYPE_AVAILABLE() );
+    }
+    else if( guard( category_i.Name() = LibCal_Event::TYPE_PARTIAL(), false ) )
+    {
+      sEvent.Type( LibCal_Event::TYPE_PARTIAL() );
+    }
+    
+    // Set the Event and the related controls...
+    // The values are explicitly assigned here 'at the beginning' to the controls,
+    // so that the values can be used by the rest of the logic. Databinding is executed too late for that.
+    // Further initialization is done in the OnCreated of the Dialog.
+    dhEvent.Data( &sEvent );
+    this.SetEventData();
+    
+    // ...and an accompanying LeadingParticipation.
+    // Only set the dates, the times will be updated from the Event later if necessary.
+    sLeadPart := owner_i.Participation( relshadow, LibCal_LeadingParticipation,
+                                        ParticipationID := [String]Key::NextPersistentKey(),
+                                        StartDate       := start_i.Date( timezone ),
+                                        EndDate         := end_i  .Date( timezone ) );
+    
+    // Set the Participation and the related controls
+    // (only the DataHolders, the Date-controls are set later on, after the recurrence has been initialized)
+    dhStartDate.Data( sLeadPart.StartDate() );
+    dhEndDate.Data(   sLeadPart.EndDate()   );
+    dhLeadingParticipation.Data( &sLeadPart );
+    
+    // Initialize the capacity here, when done in the OnCreate() edtCapacity is not disabled correctly.
+    this.InitializeCapacity();
+    
+    // Initialize the category here, when done in the OnCreate() there is no selection in the DropDownList.
+    // Select the general category for new events.
+    this.InitializeCategories();
+    this.InitializeEventTypes();
+    ddlCategory.Data( owner_i.CalendarRegistry().GetGeneralEventCategory() );
+    ddlEventType.Data( owner_i.CalendarRegistry().GetDefaultEventType() );
+    
+    // Must be done here, when done in the OnCreate() the checkmarks are not always set when the dialog is opened for editing an event.
+    // Pre-select all resources as subscriber when creating a common event.
+    this.InitializeSubscribers();
+    if( owner_i.istype( LibCal_CommonCalendar ) )
+    {
+      lstSubscribers.CheckAll();
+    }
+    
+    // Open the dialog.
+    this.Show( "modal" );
+  *]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_CreateUpdateEventAndParticipation.def b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_CreateUpdateEventAndParticipation.def
index ea28715..0c659fb 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_CreateUpdateEventAndParticipation.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_CreateUpdateEventAndParticipation.def
@@ -13,7 +13,7 @@
     subject        := edtName.Text();
     description    := edtDescription.Text();
     category       := ddlCategory.Data();
-    eventTypeList  := edtEventType.Text();
+    eventTypeList  := ddlEventType.Data();
     isDefault      := ckbApplyToNewResources.Checked();
     startDate      := dsStartDate.Date();
     startTimeOfDay := durStartTimeOfDay.Duration();
diff --git a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_InitializeEventTypes.def b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_InitializeEventTypes.def
new file mode 100644
index 0000000..0a5ef89
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_InitializeEventTypes.def
@@ -0,0 +1,17 @@
+Quintiq file version 2.0
+#parent: #root
+Method InitializeEventTypes () id:Method_LibCal_dlgEvent_InitializeEventTypes
+{
+  #keys: '[415136.0.706730202]'
+  Body:
+  [*
+    participation := dhLeadingParticipation.Data();
+    calendar      := participation.Calendar();
+    
+    eventtypes := calendar.CalendarRegistry().EventType( relget );
+    
+    dhEventTypes.Data( &eventtypes );
+    
+    // The applicable EventCategory is selected in ddlCategory.OnCreate()
+  *]
+}
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Component_PanelHeader\043144.def" "b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Component_PanelHeader\043144.def"
index 8f68633..a9c5ebc 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Component_PanelHeader\043144.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Component_PanelHeader\043144.def"
@@ -17,16 +17,6 @@
         Taborder: 0
       ]
     }
-    Component edtEventType
-    {
-      #keys: '[415136.0.647401498]'
-      BaseType: 'WebEditField'
-      Properties:
-      [
-        Label: 'Event type'
-        Taborder: 1
-      ]
-    }
     Component durStartTimeOfDay
     {
       #keys: '[415136.0.647401500]'
@@ -38,7 +28,7 @@
         Label: 'Start time'
         MaxDuration: P0DT23H59M0S
         MinDuration: P0DT0H0M0S
-        Taborder: 7
+        Taborder: 8
       ]
     }
     Component dhStartTimeOfDay
@@ -48,7 +38,7 @@
       Databinding: 'Duration'
       Properties:
       [
-        Taborder: 8
+        Taborder: 9
       ]
     }
     Component durEndTimeOfDay
@@ -62,7 +52,7 @@
         Label: 'End time'
         MaxDuration: P0DT23H59M0S
         MinDuration: P0DT0H0M0S
-        Taborder: 9
+        Taborder: 10
       ]
     }
     Component dhEndTimeOfDay
@@ -72,7 +62,7 @@
       Databinding: 'Duration'
       Properties:
       [
-        Taborder: 10
+        Taborder: 11
       ]
     }
     Component edtDescription
@@ -87,7 +77,7 @@
         Multiline: true
         NumberOfColumns: 29
         ShowLabel: false
-        Taborder: 12
+        Taborder: 13
       ]
     }
     Component dsStartDate
@@ -98,7 +88,7 @@
       [
         DateFormat: 'DMMY'
         Label: 'Date'
-        Taborder: 5
+        Taborder: 6
       ]
     }
     Component dhStartDate
@@ -108,7 +98,7 @@
       Databinding: 'Date'
       Properties:
       [
-        Taborder: 6
+        Taborder: 7
       ]
     }
     Component lblDescription id:lblDescription_456
@@ -119,7 +109,7 @@
       [
         Label: 'Description'
         NumberOfColumns: 0
-        Taborder: 11
+        Taborder: 12
       ]
     }
     Component ButtonCreate
@@ -129,7 +119,7 @@
       Properties:
       [
         Label: '鏂板缓'
-        Taborder: 13
+        Taborder: 14
       ]
     }
     Component ddslType id:ddslType_360
@@ -143,7 +133,7 @@
         ShowLabel: false
         Sorting: 'none'
         Strings: 'Available;Unavailable'
-        Taborder: 2
+        Taborder: 1
         Visible: false
       ]
     }
@@ -156,7 +146,7 @@
         DataBinding: 'dhEvent.Data.IsDefault'
         Label: 'Apply to new resources'
         NumberOfColumns: 0
-        Taborder: 3
+        Taborder: 4
         Tooltip: 'If checked, calendars of new resources will automatically subscribe to the event.'
         Visible: false
       ]
@@ -171,11 +161,49 @@
         NumberOfColumns: 0
         ShowLabel: false
         SizeRatio: 0
-        Taborder: 4
+        Taborder: 5
         Text: '<Timezone>'
         Visible: false
       ]
     }
+    Component dhEventTypes id:dhEventTypes_836
+    {
+      #keys: '[415136.0.706740648]'
+      BaseType: 'WebDataHolder'
+      Databinding: 'structured[LibCal_EventType]*'
+      Properties:
+      [
+        Taborder: 2
+      ]
+    }
+    Component ddlEventType id:ddlEventType_568
+    {
+      #keys: '[415136.0.706740548]'
+      BaseType: 'WebDropDownList'
+      Databinding: 'LibCal_EventType'
+      Children:
+      [
+        Component deEventType id:deEventType_393
+        {
+          #keys: '[415136.0.706740549]'
+          BaseType: 'WebDataExtractor'
+          Properties:
+          [
+            DataType: 'structured[LibCal_EventType]'
+            Source: 'dhEventTypes'
+            Taborder: 0
+            Transformation: 'Elements'
+          ]
+        }
+      ]
+      Properties:
+      [
+        DisplayField: 'Name'
+        NumberOfColumns: 15
+        ShowLabel: false
+        Taborder: 3
+      ]
+    }
   ]
   Properties:
   [
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateEvent\043778.def" "b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateEvent\043778.def"
index ac27f5c..a3ed57b 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateEvent\043778.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateEvent\043778.def"
@@ -56,6 +56,10 @@
     // Initialize the capacity here, when done in the OnCreate() edtCapacity is not disabled correctly.
     this.InitializeCapacity();
     
+    this.InitializeEventTypes();
+    
+    ddlEventType.Data( owner_i.CalendarRegistry().GetDefaultEventType() );
+    
     // Initialize the category here, when done in the OnCreate() there is no selection in the DropDownList.
     // Select the general category for new events.
     //this.InitializeCategories();
diff --git a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateUpdateEventAndParticipation.def b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateUpdateEventAndParticipation.def
index 0587aa7..0a7dd6c 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateUpdateEventAndParticipation.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateUpdateEventAndParticipation.def
@@ -13,7 +13,7 @@
     // Event and LeadingParticipation
     subject        := edtName.Text();
     description    := edtDescription.Text();
-    eventTypeList  := edtEventType.Text();
+    eventTypeList  := ddlEventType.Data();
     category       := sEvent.EventCategory(); 
     isDefault      := ckbApplyToNewResources.Checked();
     startDate      := dsStartDate.Date();
diff --git a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_InitializeEventTypes.def b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_InitializeEventTypes.def
new file mode 100644
index 0000000..5974a8d
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_InitializeEventTypes.def
@@ -0,0 +1,17 @@
+Quintiq file version 2.0
+#parent: #root
+Method InitializeEventTypes () id:Method_LibCal_dlgMultipleEvent_InitializeEventTypes
+{
+  #keys: '[415136.0.706780096]'
+  Body:
+  [*
+    participation := dhLeadingParticipation.Data();
+    calendar      := participation.Calendar();
+    
+    eventtypes := calendar.CalendarRegistry().EventType( relget );
+    
+    dhEventTypes.Data( &eventtypes );
+    
+    // The applicable EventCategory is selected in ddlCategory.OnCreate()
+  *]
+}

--
Gitblit v1.9.3