Quintiq file version 2.0
#parent: #root
Method ShowHideComponents (
  Boolean isbatchedit
) id:Method_DialogCreateEditPISPSpecification_ShowHideComponents
{
  #keys: '[124808.2.593321940]'
  Body:
  [*
    // Show/hide components
    
    data := Dialog.Data();
    
    pisp := select( data, ProductInStockingPoint_MP.WrappedInstance, p, p = DataHolderPISP.Data() );
    
    uom := guard( pisp.UnitOfMeasure_MP(), null( UnitOfMeasure_MP ) );
    
    isshown := false;
    
    if( not isnull( uom ) )
    {
      isshown := uom <> SelectionUnitOfMeasurement.Data();
    }
    
    ImageUnitOfMeasurement.Visible( isshown );
    ImageUnitOfMeasurement.SetProperty( 'Tooltip', pisp.GetUpdateUOMWarningMessage() );
    
    // Update components visibility for batch edit
    CheckBoxIsBatchEditUOM.Visible( isbatchedit );
    CheckBoxIsBatchEditIsNegativeInventoryAllowed.Visible( isbatchedit );
    CheckBoxIsBatchEditIsExcluded.Visible( isbatchedit );
    CheckBoxIsBatchEditIsExcludedFromBalancing.Visible( isbatchedit );
    CheckBoxIsBatchEditInputLotSize.Visible( isbatchedit );
    
    canEditSafetyStock := forall( data, ProductInStockingPoint_MP.WrappedInstance, p, p.IsLeaf() );
    CheckBoxIsBatchEditIsSafetyStockKept.Visible( isbatchedit and canEditSafetyStock );
    CheckBoxIsSafetyStockKept.Visible( canEditSafetyStock );
    CheckBoxIsBatchEditIsExcludeShelfLife.Visible( isbatchedit );
    
    TabPageValueCost.Enabled( not isbatchedit );
  *]
}
