Quintiq file version 2.0
#parent: #root
Method OnUserUpdateUI (
  Product_MP product,
  StockingPoint_MP stockingpoint
) id:Method_DialogCreateEditInventoryTarget_OnUserUpdateUI
{
  #keys: '[139394.1.931027168]'
  Body:
  [*
    // Enable disable components when user toggles ui
    isbatchedit := DataHolderDialogDatas.Data().Size() > 1;
    
    pisp := product.FindProductInStockingPoint( stockingpoint.ID() );
    
    // When user selects radio buttons etc in the UI
    this.SetLabels( [Boolean]rbgMinLevel.BoundValue(), 
                    [Boolean]rbgMaxLevel.BoundValue(),
                    guard( pisp.UnitOfMeasureName(), product.UnitOfMeasureName() ) );
    
    rbgMinLevel.Enabled( not isbatchedit or cbBatchEditMinInventory.Checked(), '' );
    efMinInventoryLevel.Enabled( not isbatchedit or cbBatchEditMinInventory.Checked(), '' );
    cbHasMaxInventory.Enabled( not isbatchedit or cbBatchEditMaxInventory.Checked(), '' );
    rbgMaxLevel.Enabled( cbHasMaxInventory.Checked()
                         and ( not isbatchedit or cbBatchEditMaxInventory.Checked() ), '' );
    efMaxInventoryLevel.Enabled( cbHasMaxInventory.Checked()
                                 and ( not isbatchedit or cbBatchEditMaxInventory.Checked() ), '' );
    
    // Set dropdownlist (sp & product) to disabled during batch edit
    ddlProduct.Enabled( not isbatchedit, Translations::MP_Designer_DisableSelectorForBatchEdit( 'product' ) );
    ddlStockingPoint.Enabled( not isbatchedit, Translations::MP_Designer_DisableSelectorForBatchEdit( 'stocking point' ) );
  *]
}
