Quintiq file version 2.0
#parent: #root
Method InitializeComponents (
  Boolean isbatchedit
) id:Method_DialogCreateEditOperation_InitializeComponents
{
  #keys: '[139394.0.1573932491]'
  Body:
  [*
    // Enable disable components
    
    DropDownListUnit.Enabled( not isbatchedit,  Translations::MP_Designer_DisableSelectorForBatchEdit( 'unit' ) );
    EditFieldID.Enabled( not isbatchedit, Translations::MP_Designer_DisableSelectorForBatchEdit( 'id' ) );
    
    CheckBoxBatchEditLeadTime.Visible( isbatchedit );
    CheckBoxBatchEditThroughput.Visible( isbatchedit );
    CheckBoxBatchEditHasUserLotSize.Visible( isbatchedit );
    CheckBoxBatchEditStandardDeviation.Visible( isbatchedit );
    CheckboxBatchCO2.Visible( isbatchedit );
    
    data := DataHolderDialogData.Data();
    
    // Enable / disable components in general tab
    DurationSelectorLeadTime.Enabled( not isbatchedit, '' );
    
    istime := data.Unit().HasCapacityTypeTimeBase();
    EditFieldThroughput.Enabled( istime and not isbatchedit ,
                                 Translations::MP_Operation_InvalidCapacityType_Time() );
    
    
    // Enable / disable components in Lot size tab
    CheckboxHasUserLotSize.Enabled( not isbatchedit, '' );
    CheckboxHasUserMaximumQuantity.Enabled( data.HasUserLotSize() and not isbatchedit, '' );
    EditFieldUserMinimumQuantity.Enabled( data.HasUserLotSize() and not isbatchedit, '' );
    EditFieldUserMaximumQuantity.Enabled( data.HasUserLotSize()
                                          and data.HasUserMaximumQuantity() 
                                          and not isbatchedit, '' );
    EditFieldUserLotSize.Enabled( data.HasUserLotSize() and not isbatchedit, '' );
    
    this.SetLotSizeLabel( data.LotSize() );
    
    // Enable / disable components in Advanced tab
    DurationSelectorSTDLeadTime.Enabled( not isbatchedit, '' );
    
    // Set CO2 tooltip
    gpProcessUoM := MacroPlan.GlobalParameters_MP().CO2ProcessUoM();
    EditFieldCO2Emission.Tooltip( Translations::MP_GlobalParameters_CO2OperationTooltip( gpProcessUoM ) )
    
    qtytoprocess := data.Unit().QuantityToProcess();
    // Set MinimumQuantity, MaximumQuantity and LotSize tooltip
    EditFieldUserMinimumQuantity.Tooltip( Translations::MP_Designer_DialogCreateEditOperation_MinimumQuantity_Tooltip( qtytoprocess ) );
    CheckboxHasUserMaximumQuantity.Tooltip( Translations::MP_Designer_DialogCreateEditOperation_MaximumQuantity_Tooltip( qtytoprocess ) );
    EditFieldUserMaximumQuantity.Tooltip( Translations::MP_Designer_DialogCreateEditOperation_MaximumQuantity_Tooltip( qtytoprocess ) );
    EditFieldUserLotSize.Tooltip( Translations::MP_Designer_DialogCreateEditOperation_LotSize_Tooltip( qtytoprocess ) );
  *]
}
