Quintiq file version 2.0
#parent: #root
Method EditTransportAvailability (
  internal[GUIComponent] parent,
  structured[TransportAvailability] selection
) id:Method_DialogCreateEditTransportAvailability_EditTransportAvailability
{
  #keys: '[121458.0.772017088]'
  Body:
  [*
    // Edit unit availabilities 
    
    isbatchedit := selection.Size() > 1;
    Dialog.ShowHideComponentForBatchEdit( isbatchedit, true, false );
    
    data := shadow( selection.Element( 0 ) );
    Dialog.Data( data );
    
    result := this.DoModal( parent );
    
    if( result > 0 ) 
    {
      TransportAvailability::Update( selection,
                                     data.Unit(),
                                     GUIStartDateTimeSelector.DateTime(), // Read-only, apply changes to shadow is not taking place for read-only attribute when editing.
                                     CheckBoxBatchEditMaintenance.Checked(),
                                     data.TimeUnit(),
                                     data.Maintenance(),
                                     CheckBoxBatchEditNumberOfUnit.Checked(),
                                     data.NumberOfUnit(),
                                     CheckBoxBatchEditLotSize.Checked(), 
                                     data.LotSize(),
                                     data.MinimumPerLot(),
                                     CheckBoxBatchEditCapacity.Checked(),                                 
                                     data.MaximumQuantity(),
                                     CheckBoxBatchEditShiftPattern.Checked(),
                                     data.ShiftPattern() );
    }
  *]
}
