Quintiq file version 2.0
#parent: #root
Method Edit (
  structured[BaseRecipeIngredient] selection,
  internal[GUIComponent] parent
) id:Method_DialogCreateEditBaseRecipeIngredient_Edit
{
  #keys: '[110994.0.979712521]'
  Body:
  [*
    // Edit recipe ingredient
    isbatchedit := selection.Size() > 1;
    data := shadow( selection.Element( 0 ) );
    Dialog.Data( data );
    
    Dialog.ShowHideComponentForBatchEdit( isbatchedit );
    Dialog.EnableDisableComponents();
    
    result := Dialog.DoModal( parent );
    
    if( result > 0 )
    {
      if( isbatchedit )
      {
        BaseRecipeIngredient::Update( selection,
                                      CheckBoxBatchEditMin.Checked(),
                                      data.Minimum(),
                                      CheckBoxBatchEditMax.Checked(),
                                      data.Maximum(),
                                      CheckBoxBatchEditNom.Checked(),
                                      data.Nominal(),
                                      false );
      }
      else
      {
        data.Commit();
      }    
    }
  *]
}
