Quintiq file version 2.0
#parent: #root
Method InitializeComponents (
  Boolean isbatchedit
) id:Method_DialogCreateEditInventoryTarget_InitializeComponents
{
  #keys: '[139394.1.922897751]'
  Body:
  [*
    // Initialize dialog data
    
    // Disable/Hide UIs for batch edit
    ddlProduct.Enabled( not isbatchedit,  Translations::MP_Designer_DisableSelectorForBatchEdit( 'product' ) );
    ddlStockingPoint.Enabled( not isbatchedit, Translations::MP_Designer_DisableSelectorForBatchEdit( 'stocking point' ) );
    dsStart.Enabled( not isbatchedit, Translations::MP_Designer_DisableSelectorForBatchEdit( 'start' ) )
    
    cbBatchEditMinInventory.Visible( isbatchedit );
    cbBatchEditMaxInventory.Visible( isbatchedit );
    
    // Set edit fields value according to the data
    data := DataHolderDialogData.Data();
    
    mininventory := ifexpr( data.HasMinLevelInDays(), data.MinLevelInDays(), data.MinLevelInQuantity() );
    maxinventory := ifexpr( data.HasMaxLevelInDays(), data.MaxLevelInDays(), data.MaxLevelInQuantity() );
    efMinInventoryLevel.Text( ApplicationMacroPlanner.FormatRealToString( mininventory ) );
    efMaxInventoryLevel.Text( ApplicationMacroPlanner.FormatRealToString( maxinventory ) );
    
    rbgMinLevel.Enabled( not isbatchedit, '' );
    efMinInventoryLevel.Enabled( not isbatchedit, '' );
    cbHasMaxInventory.Enabled( not isbatchedit, '' );
    rbgMaxLevel.Enabled( not isbatchedit and data.HasMaxLevel(), '' )
    efMaxInventoryLevel.Enabled( not isbatchedit and data.HasMaxLevel(), '' );
    
    this.SetLabels( data.HasMinLevelInDays(), data.HasMaxLevelInDays(),
                    guard( data.ProductInStockingPoint_MP().UnitOfMeasureName(), data.Product_MP().UnitOfMeasureName() ) );
  *]
}
