Quintiq file version 2.0
#parent: #root
Method EnableDisableBatch () id:Method_DialogCreateEditOperationCost_EnableDisableBatch
{
  #keys: '[145730.1.105027684]'
  Body:
  [*
    // Enable /disable batch edit components
    isBatchEdit := DataHolderDialogDatas.Data().Size() > 1;
    isBatchCreate := DataHolderOperations.Data().Size() > 1;
    tooltip := Translations::MP_Batch_Disabled_Edit();
    
    
    // When in batch, disable non-editable fields with tooltips to inform
    DropDownListAccount.Enabled( not isBatchEdit, tooltip );
    DropDownStringListCostDriver.Enabled( not isBatchEdit, tooltip );
    DropDownListOperation.Enabled( not (isBatchCreate or isBatchEdit), Translations::MP_Batch_Disabled_Create_Edit() );
    DateSelectorCostStart.Enabled( not isBatchEdit, tooltip );
    
    // Time unit, length of time, cost disabled when created, no tooltip because can be enabled thru checkbox
    DropDownStringListTimeUnit.Enabled( not isBatchEdit, '' );
    EditFieldLengthOfTime.Enabled( not isBatchEdit, '' );
    EditFieldCost.Enabled( not isBatchEdit, '' );
    
    // The checkboxes visibility is according to batch edit
    CheckboxBatchEditTimeUnit.Visible( isBatchEdit );
    CheckboxBatchEditTimeUnit.Visible( isBatchEdit );
    CheckboxBatchEditLengthOfTime.Visible( isBatchEdit );
    CheckboxBatchEditCost.Visible( isBatchEdit );
  *]
}
