- $vehicleTypes = array('Truck', 'Vehicle', 'Motorcycle', 'Bus', 'Kemler')

%form#stats-form
  .controls
    %h4
      %i.icon-time
      = t('When')
      %small= t('Choose a date range')
    .btn-group#when-buttons
      %button.btn(type='button'
        data-behavior='DatePickSetter'
        data-datepick-setter-range='7'
        data-datepick-setter-start-target="#datepicker-start-date"
        data-datepick-setter-end-target="#datepicker-end-date")= t('Last 7 days')
      %button.btn(type='button'
        data-behavior='DatePickSetter'
        data-datepick-setter-range='30'
        data-datepick-setter-start-target="#datepicker-start-date"
        data-datepick-setter-end-target="#datepicker-end-date")= t('Last 30 days')

  .controls
    .input-prepend.input-append
      %span.add-on= t('From')
      %input#datepicker-start-date.date-picker.span2(type='text' value='' readonly='true')
      %input#start-timestamp(type="hidden" name="startTimestamp")
      %span.add-on.icon-calendar

    .input-prepend.input-append
      %span.add-on= t('To')
      %input#datepicker-end-date.date-picker.span2(type='text' value='' readonly='true')
      %input#end-timestamp(type="hidden" name="endTimestamp")
      %span.add-on.icon-calendar


    .controls
      #datepicker-start-time.input-prepend.input-append.time-picker(data-time="00:00")
        %span.add-on= t('From')
        %input.span1(data-format="#{Yii::app()->params['timeselect_format'][Yii::app()->language]['view']}" type="text"  name="startTime" data-time="00:00" value="00:00")
        %span.add-on
          %i(data-time-icon="icon-time" data-date-icon="icon-calendar")
      #datepicker-end-time.input-prepend.input-append.time-picker
        %span.add-on= t('To')
        %input.span1(data-format="#{Yii::app()->params['timeselect_format'][Yii::app()->language]['view']}" type="text"  name="endTime" value="23:59")
        %span.add-on
          %i(data-time-icon="icon-time" data-date-icon="icon-calendar")
  %hr

  .controls
    %h4
      %i.icon-map-marker
      = t('Where')
      %small= t('Gates')
      %button.btn.btn-mini(type='button'
        data-behavior='CheckboxMaster'
        data-checkbox-master-btngroup-target="#gates")
        %i.icon-check
    #gates.btn-group(data-toggle='buttons-checkbox')
      - $gtcnt = 0
      - foreach($gates as $gate)
        %button.btn.btn-gate(type='button')
          = "{$gate->short_name}"
          %input(type='checkbox' name='gates[]' value="#{$gate->Gate}")
        - if(++$gtcnt % 2 == 0)
          %br

  %hr

  .controls
    %h4
      %i.icon-truck
      = t('What')
      %small= t('Vehicle Type')
      %button.btn.btn-mini(type='button'
        data-behavior='CheckboxMaster'
        data-checkbox-master-btngroup-target="#vehicles")
        %i.icon-check
    #vehicles.btn-group(data-toggle='buttons-checkbox')
      - $vtcnt = 0
      - foreach ($vehicleTypes as $vehicleType)
        %button.btn(type='button')
          = t($vehicleType)
          %input(type='checkbox' name="vehiclesClass[]" value="#{$vehicleType}")
        - if(++$vtcnt % 4 == 0)
          %br  

  %hr

  .controls
    %h4
      %i.icon-dashboard
      = t('Speed')

    #slider-range

    .form-inline.controls
      .input-prepend.input-append
        %span.add-on
          = t('Min')
        %input#min-speed.span1(type="text" name="minSpeed" readonly="readonly")
        %span.add-on
          Km/h

      .input-prepend.input-append
        %span.add-on
          = t('Max')
        %input#max-speed.span1(type="text" name="maxSpeed" readonly="readonly")
        %span.add-on
          Km/h

  %hr

  .controls
    %h4
      %i.icon-sort-by-attributes
      = t('Granularity')
    %select#granularity(name="granularity")
      %option(value="300")= t("5 minutes")
      %option(value="600")= t("10 minutes")
      %option(value="1800")= t("30 minutes")
      %option(value="3600")= t("1 hour")
      %option(value="7200")= t("2 hours")
      %option(value="86400")= t("1 day")
      %option(value="604800")= t("1 solar week")
      %option(value="2592000")= t("1 solar month")


  .controls
    %button.btn(type="submit")= t('Compute')
    %button.btn(type="export" data-target="#{Yii::app()->createUrl('stats/export')}")= t('Export')
    %button.btn(type="export" data-target="#{Yii::app()->createUrl('stats/exportDetailed')}")= t('Detailed export')
    