-if($field->visible)
  .control-group(title="#{$field->description}")
    .btn-group#when-buttons
      %button.btn(type='button' data-behavior='DateRangeSetter' data-daterange-setter-when='today' data-daterange-setter-start-date='#field_validity_startDate' data-daterange-setter-start-time='#field_validity_startTime' data-daterange-setter-end-date='#field_validity_endDate' data-daterange-setter-end-time='#field_validity_endTime')
        = t('Today')
      %button.btn(type='button' data-behavior='DateRangeSetter' data-daterange-setter-when='thisweek' data-daterange-setter-start-date='#field_validity_startDate' data-daterange-setter-start-time='#field_validity_startTime' data-daterange-setter-end-date='#field_validity_endDate' data-daterange-setter-end-time='#field_validity_endTime')
        = t('This week')
      %button.btn(type='button' data-behavior='DateRangeSetter' data-daterange-setter-when='thismonth' data-daterange-setter-start-date='#field_validity_startDate' data-daterange-setter-start-time='#field_validity_startTime' data-daterange-setter-end-date='#field_validity_endDate' data-daterange-setter-end-time='#field_validity_endTime')
        = t('This month')
      %button.btn(type='button' data-behavior='DateRangeSetter' data-daterange-setter-when='thisyear' data-daterange-setter-start-date='#field_validity_startDate' data-daterange-setter-start-time='#field_validity_startTime' data-daterange-setter-end-date='#field_validity_endDate' data-daterange-setter-end-time='#field_validity_endTime')
        = t('This year')
  .control-group
    .btn-group#when-buttons
      %button.btn(type='button' data-behavior='DateRangeSetter' data-daterange-setter-when='tomorrow' data-daterange-setter-start-date='#field_validity_startDate' data-daterange-setter-start-time='#field_validity_startTime' data-daterange-setter-end-date='#field_validity_endDate' data-daterange-setter-end-time='#field_validity_endTime')
        = t('Tomorrow')
      %button.btn(type='button' data-behavior='DateRangeSetter' data-daterange-setter-when='nextweek' data-daterange-setter-start-date='#field_validity_startDate' data-daterange-setter-start-time='#field_validity_startTime' data-daterange-setter-end-date='#field_validity_endDate' data-daterange-setter-end-time='#field_validity_endTime')
        = t('Next week')
      %button.btn(type='button' data-behavior='DateRangeSetter' data-daterange-setter-when='nextmonth' data-daterange-setter-start-date='#field_validity_startDate' data-daterange-setter-start-time='#field_validity_startTime' data-daterange-setter-end-date='#field_validity_endDate' data-daterange-setter-end-time='#field_validity_endTime')
        = t('Next month')
      %button.btn(type='button' data-behavior='DateRangeSetter' data-daterange-setter-when='nextyear' data-daterange-setter-start-date='#field_validity_startDate' data-daterange-setter-start-time='#field_validity_startTime' data-daterange-setter-end-date='#field_validity_endDate' data-daterange-setter-end-time='#field_validity_endTime')
        = t('Next year')
  -$customValidityPeriods = $field->valuesArray
  -if(is_array_ex($customValidityPeriods,true))
    .control-group
      .btn-group#when-buttons
        -$btnCVPindex=0
        -foreach($customValidityPeriods as $cvpLabel => $cvpDate)
          %button.btn(type='button' data-behavior='DateRangeSetter' data-daterange-setter-when="#{$cvpDate}" data-daterange-setter-start-date='#field_validity_startDate' data-daterange-setter-start-time='#field_validity_startTime' data-daterange-setter-end-date='#field_validity_endDate' data-daterange-setter-end-time='#field_validity_endTime')
            =$cvpLabel
          -$btnCVPindex++
          -if($btnCVPindex % 4 == 0 && $btnCVPindex > 0)
            %br