Quintiq file version 2.0
#parent: #root
Method UIShowHideComponentForBatchEdit (
  Boolean isInit,
  Boolean isBatchEdit
) id:Method_DialogCreateEditPISPSpecification_UIShowHideComponentForBatchEdit
{
  #keys: '[135040.0.219771730]'
  Body:
  [*
    // Handles the toggling of the batch related component
    if(  isInit )
    {
      //for initialize, control batch checkboxes visibility
      
      CheckboxBatchIsOverrideUOMForProduct.Visible( isBatchEdit );
      CheckboxBatchIsNegativeInventoryAllowed.Visible( isBatchEdit );
      CheckboxBatchIsExcluded.Visible( isBatchEdit );
      CheckboxBatchIsExcludedFromBalancing.Visible( isBatchEdit );
      CheckboxBatchIsSafetyStockKept.Visible( isBatchEdit );
      CheckboxBatchLotSize.Visible( isBatchEdit );
      CheckBoxIsBatchEditIsExcludeShelfLife.Visible( isBatchEdit );
      
      //disable all other component  
      if( isBatchEdit )
      {
        //do nothing, becasue all component is batch-editable
      } 
    }
    
    //batch UOM
    batchValidUOM := ifexpr( isInit
                            ,not isBatchEdit //when isBatchEdit,default=disable all
                            ,CheckboxBatchIsOverrideUOMForProduct.Checked() 
                           );
    CheckboxIsOverrideUOMForProduct.Enabled( batchValidUOM, "" );
    DropDownListUOM.Enabled( batchValidUOM
                             and CheckboxBatchIsOverrideUOMForProduct.Checked() 
                             , "" );
    
    //batch negative inv
    batchNegativeInvActive:= ifexpr( isInit
                                    ,not isBatchEdit //when isBatchEdit,default=disable all
                                    ,CheckboxBatchIsNegativeInventoryAllowed.Checked() 
                                    ); 
    CheckboxIsNegativeInventoryAllowed.Enabled( batchNegativeInvActive, "" );
    
    //batch IsExclude
    batchIsExcludedActive:= ifexpr( isInit
                                   ,not isBatchEdit //when isBatchEdit,default=disable all
                                   ,CheckboxBatchIsExcluded.Checked() 
                                   ); 
    CheckboxIsExcluded.Enabled( batchIsExcludedActive, "" );
    
    //batch Balancing
    batchBalancingActive:= ifexpr( isInit
                                   ,not isBatchEdit //when isBatchEdit,default=disable all
                                   ,CheckboxBatchIsExcludedFromBalancing.Checked() 
                                  ); 
    CheckboxIsExcludedFromBalancing.Enabled( batchBalancingActive, "" );
    
    //batch SafetyStock
    batchSafetyActive:= ifexpr( isInit
                                ,not isBatchEdit //when isBatchEdit,default=disable all
                                ,CheckboxBatchIsSafetyStockKept.Checked() 
                               ); 
    CheckboxIsSafetyStockKept.Enabled( batchSafetyActive, "" );
    
    
    //batch lotsize
    batchLotSizeActive:= ifexpr( isInit
                                ,not isBatchEdit //when isBatchEdit,default=disable all
                                ,CheckboxBatchLotSize.Checked() 
                               ); 
    EditFieldInputLotSizeUOM.Enabled( batchLotSizeActive, "" );
    
    //batch exclude shelf life
    batchExcludeShelfLife:= ifexpr( isInit
                                ,not isBatchEdit //when isBatchEdit,default=disable all
                                ,CheckBoxIsBatchEditIsExcludeShelfLife.Checked() 
                               ); 
    CheckBoxIsExcludeShelfLife.Enabled( batchExcludeShelfLife, "" );
  *]
}
