Quintiq file version 2.0
#parent: ListTrip
Response OnDropEmpty (
  structured[ProductInStockingPointInPeriodPlanningLeaf] information
) id:Response_ListTrip_OnDropEmpty
{
  #keys: '[113694.0.1639603265]'
  Body:
  [*
    // Create Trips by droping PISPIPs on empty place
    trip := null( Trip );
    legcounter := 0
    
    if( information.Size() = 1 )    // Skip counter if more than one pispip is selected.
    {
      legcounter := counter( information, Elements.ProductInStockingPoint_MP.LaneLegOutput.LaneLeg, leg, leg.GetIsEnabled() );
    }
    
    // If only 1 pispip is selected and there is more than one leg, prompt the dialog for user to select a leg.
    if( legcounter > 1 )
    {
      dlg := construct( DialogCreateEditTrip );
      trip := dlg.NewTripWithProduct( this, information.Element( 0 ) );
    }
    else
    {
      // Create trips with products in trip based on PISPIPs
      trip := Trip::CreateWithProductInTrips( information, null( LaneLeg ) );
    }
    
    ApplicationLibMacroPlanner.AutoExpandSelection( ListTrip, trip );
  *]
  CanBindMultiple: false
  DefinitionID: 'Responsedef_List_OnDropEmpty'
  Precondition:
  [*
    return Trip::CanCreate( information, feedback );
  *]
}
