Quintiq file version 2.0
#parent: #root
Method UIShowHideComponentForBatchEdit (
  Boolean isInit,
  Boolean isBatchEdit
) id:Method_DialogCreateEditProduct_UIShowHideComponentForBatchEdit #extension
{
  Body:
  [*
    // Handles the toggling of the batch related component
    if(  isInit )
    {
      //for initialize, control batch checkboxes visibility
      
      CheckBoxBatchEditParent.Visible( isBatchEdit );  
      CheckBoxBatchEditUOM.Visible( isBatchEdit );  
        
      CheckBoxBatchEditShelfLife.Visible( isBatchEdit );  
      CheckBoxBatchEditMaturation.Visible( isBatchEdit );
      CheckBoxBatchEditByProduct.Visible( isBatchEdit );  
      CheckBoxBatchEditExcludeFromOptimizer.Visible( isBatchEdit );  
      CheckboxBatchEditExcludeFromFulfillmentKPI.Visible( isBatchEdit );
      
      CheckBoxBatchEditNote.Visible( isBatchEdit );  
      
      LabelBatchEditSpacerName.Visible( isBatchEdit );  
      LabelBatchEditSpacerID.Visible( isBatchEdit );  
      LabelBatchEditSpacerGeneration.Visible( isBatchEdit );  
      LabelBatchEditSpacerMQBMLB.Visible( isBatchEdit );  
      LabelBatchEditSpacerPower.Visible( isBatchEdit );  
      
      //disable all other component  
      if( isBatchEdit )
      {
        disableText := Translations::MP_Product_DialogCreateEdit_DisableForBatchEdit();
        disableFlag := false;
        
        selParentProduct.Enabled( disableFlag, disableText );
        EditFieldID.Enabled( disableFlag, disableText );
        EditFieldName.Enabled( disableFlag, disableText );
        EditFieldGeneration.Enabled( disableFlag, disableText );
        EditFieldMQBMLB.Enabled( disableFlag, disableText );
        EditFieldPower.Enabled( disableFlag, disableText );
      }
    }
    
    //batch parent
    batchParentActive := ifexpr( isInit
                                 ,not isBatchEdit //when isBatchEdit,default=disable all
                                 ,CheckBoxBatchEditParent.Checked() 
                                ); 
    selParentProduct.Enabled( batchParentActive, "" );
    
    //batch UOM
    batchUOMActive := ifexpr(  isInit
                              ,not isBatchEdit //when isBatchEdit,default=disable all
                              ,CheckBoxBatchEditUOM.Checked() 
                             ); 
    DropDownListUOM.Enabled( batchUOMActive, "" );
    
    //batch shelf life
    batchShelfLifeActive := ifexpr( isInit
                                   ,not isBatchEdit //when isBatchEdit,default=disable all
                                   ,CheckBoxBatchEditShelfLife.Checked() 
                                  );
    CheckBoxHasShelfLife.Enabled( batchShelfLifeActive, "" );
    EditFieldShelfLife.Enabled( batchShelfLifeActive
                                and CheckBoxHasShelfLife.Checked()
                                , "" );
    //batch maturation
    batchMaturationActive := ifexpr( isInit
                                   ,not isBatchEdit //when isBatchEdit,default=disable all
                                   ,CheckBoxBatchEditMaturation.Checked() 
                                  );
    CheckBoxHasMaturation.Enabled( batchMaturationActive, "" );
    EditFieldMaturation.Enabled( batchMaturationActive
                                and CheckBoxHasMaturation.Checked()
                                , "" );
    
    //batch by-product
    batchByProductActive := ifexpr( isInit
                                   ,not isBatchEdit //when isBatchEdit,default=disable all
                                   ,CheckBoxBatchEditByProduct.Checked() 
                                  );
    CheckBoxIsByProduct.Enabled( batchByProductActive, "" );
    
    
    //batch exclude optimizer
    batchExcludeOptiActive := ifexpr( isInit
                                     ,not isBatchEdit //when isBatchEdit,default=disable all
                                     ,CheckBoxBatchEditExcludeFromOptimizer.Checked() 
                                    );
    CheckBoxExcludeFromOptimizer.Enabled( batchExcludeOptiActive
                                          and not CheckBoxIsPlannedAfterOptimization.Checked()
                                          , "" );
    CheckBoxIsPlannedAfterOptimization.Enabled( batchExcludeOptiActive
                                                and CheckBoxExcludeFromOptimizer.Checked()
                                                , "" );
    
    //batch isexcludedfromfulfillmentkpi
    batchByIsExcludedFulfillmentKPIActive := ifexpr( isInit
                                                     ,not isBatchEdit //when isBatchEdit,default=disable all
                                                     ,CheckboxBatchEditExcludeFromFulfillmentKPI.Checked() 
                                                    );
    CheckboxIsExcludedFromFulfillmentKPI.Enabled( batchByIsExcludedFulfillmentKPIActive, "" );
    
    //batch Note
    batchNoteActive:= ifexpr( isInit
                              ,not isBatchEdit //when sBatchEdit,default=disable all
                              ,CheckBoxBatchEditNote.Checked() 
                            ); 
    EditFieldNotes.Enabled( batchNoteActive, "" );
  *]
}
