Quintiq file version 2.0
#parent: #root
Method UpdateCheckboxState () id:Method_DialogCreateEditCampaign_UpdateCheckboxState
{
  #keys: '[146302.1.856949889]'
  Body:
  [*
    // Change radio button
    Form.OnChangedRadioButton();
    
    // Set binding value in radio group buttons
    data := DataHolderDialogData.Data();
    checkedRadioButton := RadioButtonGroupQuantityDuration.BoundValue();
    quantitybased := checkedRadioButton = GlobalParameters_MP::GetCampaignTransitionsTypeQuantity();
    durationbased := not quantitybased;
    
    // By checking duration it will HasInput to quantity if nothing is found
    ischeckedmaxqty := quantitybased and EditorCampaignMaxQuantity.Enabled();
    ischeckedmaxdur := durationbased and DurationSelectorMaxDuration.Enabled();
    
    hasoperation := data.CampaignType_MP().OperationInCampaignType( relsize ) > 0;
    
    //show/hide durations
    LabelIndicatedQuantityBasedOnMinDuration.Visible( durationbased and hasoperation );
    LabelIndicatedQuantityBasedOnMaxDuration.Visible( durationbased and ischeckedmaxdur and hasoperation );
    PanelMinimumDuration.Visible( durationbased );
    PanelMaximumDuration.Visible( durationbased );
    
    //show/hide quantity
    LabelIndicatedDurationBasedOnMinQty.Visible( quantitybased and hasoperation );
    LabelIndicatedDurationBasedOnMaxQty.Visible( quantitybased and ischeckedmaxqty and hasoperation );
    PanelMinimumQuantity.Visible( quantitybased );
    PanelMaximumQuantity.Visible( quantitybased );
    
    // Update uom for min max quantity 
    Form.UpdateUoM( data.CampaignType_MP().Unit() );
    Form.SetIndicatorValues();
  *]
}
