| Quintiq file version 2.0 | 
| #parent: #root | 
| Method ToggleSettingsForm ( | 
|   internal[WebButton] button | 
| ) id:Method_ApplicationMacroPlanner_ToggleSettingsForm | 
| { | 
|   #keys: '[137862.0.1964280202]' | 
|   Body: | 
|   [* | 
|     //Open or close form based on button state  | 
|      | 
|     if( not isnull( button ) ) | 
|     {   | 
|       if( button.Name() = 'ButtonPriorities' ) | 
|       { | 
|         if( button.IsPressed() ) | 
|         { | 
|           frm := construct( FormPriorities ); | 
|           frm.ShowDockRight();        | 
|         } | 
|         else | 
|         { | 
|           frm2 := select( DataHolderSettingsForms.Data(), Elements.astype( FormPriorities ), webform, true ); | 
|           if( not isnull( frm2 ) ) | 
|           { | 
|             frm2.Close();        | 
|           } | 
|         } | 
|       } | 
|       else if( button.Name() = 'ButtonFulfillmentTargets' ) | 
|       { | 
|         if( button.IsPressed() ) | 
|         { | 
|           frm := construct( FormFulfillmentTarget ); | 
|           frm.ShowDockRight(); | 
|         } | 
|         else | 
|         { | 
|           frm2 := select( DataHolderSettingsForms.Data(), Elements.astype( FormFulfillmentTarget ), webform, true ); | 
|           if( not isnull( frm2 ) ) | 
|           { | 
|             frm2.Close(); | 
|           } | 
|         } | 
|       } | 
|       else if( button.Name() = 'ButtonFulfillmentRestrictions' ) | 
|       { | 
|         if( button.IsPressed() ) | 
|         { | 
|           frm := construct( FormFulfillmentRestriction ); | 
|           frm.ShowDockRight();  | 
|         } | 
|         else | 
|         { | 
|           frm2 := select( DataHolderSettingsForms.Data(), Elements.astype( FormFulfillmentRestriction ), webform, true ); | 
|           if( not isnull( frm2 ) ) | 
|           { | 
|             frm2.Close(); | 
|           } | 
|         } | 
|       } | 
|       else if( button.Name() = 'ButtonPostponementSettings' ) | 
|       { | 
|         if( button.IsPressed() ) | 
|         { | 
|           frm := construct( FormPostponementSettings ); | 
|           frm.ShowDockRight(); | 
|         } | 
|         else | 
|         { | 
|           frm2 := select( DataHolderSettingsForms.Data(), Elements.astype( FormPostponementSettings ), webform, true ); | 
|           if( not isnull( frm2 ) ) | 
|           { | 
|             frm2.Close(); | 
|           } | 
|         } | 
|       } | 
|       else if( button.Name() = 'ButtonDoSanityCheck' ) | 
|       { | 
|         if( button.IsPressed() ) | 
|         { | 
|           frm := construct( FormSanityCheck ); | 
|           frm.ShowDockRight(); | 
|         } | 
|         else | 
|         { | 
|           frm2 := select( DataHolderSettingsForms.Data(), Elements.astype( FormSanityCheck ), webform, true ); | 
|           if( not isnull( frm2 ) ) | 
|           { | 
|             frm2.Close(); | 
|           } | 
|         } | 
|       } | 
|       else if( button.Name() = 'ButtonSafetyStockParameters' ) | 
|       { | 
|         if( button.IsPressed() ) | 
|         { | 
|           frm := construct( FormSafetyStockParameter ); | 
|           frm.ShowDockRight();  | 
|         } | 
|         else | 
|         { | 
|           frm2 := select( DataHolderSettingsForms.Data(), Elements.astype( FormSafetyStockParameter ), webform, true ); | 
|           if( not isnull( frm2 ) ) | 
|           { | 
|             frm2.Close(); | 
|           } | 
|         } | 
|       } | 
|       else if( button.Name() = 'ButtonDeviationDetection' ) | 
|       { | 
|         if( button.IsPressed() ) | 
|         { | 
|           frm := construct( FormDeviationDetection ); | 
|           frm.ShowDockRight();  | 
|         } | 
|         else | 
|         { | 
|           frm2 := select( DataHolderSettingsForms.Data(), Elements.astype( FormDeviationDetection ), webform, true ); | 
|           if( not isnull( frm2 ) ) | 
|           { | 
|             frm2.Close(); | 
|           } | 
|         } | 
|       } | 
|       else if( button.Name() = 'ButtonGeneralSettings' ) | 
|       { | 
|         if( button.IsPressed() ) | 
|         { | 
|           frm := construct( FormGeneralSettings ); | 
|           frm.ShowDockRight(); | 
|         } | 
|         else | 
|         { | 
|           frm2 := select( DataHolderSettingsForms.Data(), Elements.astype( FormGeneralSettings ), webform, true ); | 
|           if( not isnull( frm2 ) ) | 
|           { | 
|             frm2.Close(); | 
|           } | 
|         } | 
|       } | 
|       else if( button.Name() = 'ButtonDefaultCapacities' ) | 
|       { | 
|         if( button.IsPressed() ) | 
|         { | 
|           frm := construct( FormDefaultCapacities ); | 
|           frm.ShowDockRight();  | 
|         } | 
|         else | 
|         { | 
|           frm2 := select( DataHolderSettingsForms.Data(), Elements.astype( FormDefaultCapacities ), webform, true ); | 
|           if( not isnull( frm2 ) ) | 
|           { | 
|             frm2.Close(); | 
|           } | 
|         } | 
|       } | 
|       else if( button.Name() = 'ButtonBottleneckDetection' ) | 
|       { | 
|         if( button.IsPressed() ) | 
|         { | 
|           frm := construct( FormBottleneckDetectionParameters ); | 
|           frm.ShowDockRight(); | 
|         } | 
|         else | 
|         { | 
|           frm2 := select( DataHolderSettingsForms.Data(), Elements.astype( FormBottleneckDetectionParameters ), webform, true ); | 
|           if( not isnull( frm2 ) ) | 
|           { | 
|             frm2.Close(); | 
|           } | 
|         } | 
|       }  | 
|       else if( button.Name() = 'ButtonScenarioSanityCheckParameters' ) | 
|       { | 
|         if( button.IsPressed() ) | 
|         { | 
|           frm := construct( FormSanityCheckParameters ); | 
|           frm.ShowDockRight();  | 
|         } | 
|         else | 
|         { | 
|           frm2 := select( DataHolderSettingsForms.Data(), Elements.astype( FormSanityCheckParameters ), webform, true ); | 
|           if( not isnull( frm2 ) ) | 
|           { | 
|             frm2.Close(); | 
|           } | 
|         } | 
|       } | 
|       else if( button.Name() = 'ButtonKPIHorizonSettings' ) | 
|       { | 
|         if( button.IsPressed() ) | 
|         { | 
|           frm := construct( FormKPIHorizonSettings ); | 
|           frm.ShowDockRight();  | 
|         } | 
|         else | 
|         { | 
|           frm2 := select( DataHolderSettingsForms.Data(), Elements.astype( FormKPIHorizonSettings ), webform, true ); | 
|           if( not isnull( frm2 ) ) | 
|           { | 
|             frm2.Close(); | 
|           } | 
|         } | 
|       } | 
|       else if( button.Name() = 'ButtonServiceLevel' ) | 
|       { | 
|         if( button.IsPressed() ) | 
|         { | 
|           frm := construct( FormServiceLevel ); | 
|           frm.ShowDockRight(); | 
|         } | 
|         else  | 
|         { | 
|           frm2 := select( DataHolderSettingsForms.Data(), Elements.astype( FormServiceLevel ), webform, true ); | 
|           if( not isnull( frm2 ) ) | 
|           { | 
|             frm2.Close(); | 
|           } | 
|         } | 
|       } | 
|       else if( button.Name() = 'ButtonStrategy' ) | 
|       { | 
|         if( button.IsPressed() ) | 
|         { | 
|           frm := construct( FormOptimizerStrategiesSlideIn ); | 
|           frm.ShowDockRight(); | 
|         } | 
|         else  | 
|         { | 
|           frm2 := select( DataHolderSettingsForms.Data(), Elements.astype( FormOptimizerStrategiesSlideIn ), webform, true ); | 
|           if( not isnull( frm2 ) ) | 
|           { | 
|             frm2.Close(); | 
|           } | 
|         } | 
|       } | 
|     } | 
|   *] | 
| } |