#plateauthrenew-page
  
  .page-header
    %h2
      =t('Plate authorization renew')
  
  .row

    .form-box
      - $form = $this->beginWidget('bootstrap.widgets.TbActiveForm',                        |
                  array(                                                                    |
                  'id'=>'plateauthrenew-many-form',                                         |
                  'action' => Yii::app()->createUrl('plateAuthorization/renewMany'),        |
                  'method'=>'GET',                                                          |
                ))                                                                          |

      - if(isEmpty($request->newStartDate))
        - $now = new DateTime()
        - $endDate = $item->DataFine
        - $startDate = ($endDate < $now) ? $now : $endDate
        - $startDateEx = new DateTimeEx($startDate)
      - else
        - $startDateEx = new DateTimeEx($request->newStartDate)
      - $startDateEx->setTime(0,0,0)
      - $startDate = $startDateEx->toDateTime()
      
      %span
        %fieldset
          %b=t('Search')
          %input(type="text" disabled="disabled" value="#{$search}" class="span2")
          %b=t('Time interval')
          %input(type="text" disabled="disabled" value="#{$timeRanges[$timeRange]}")
          %b=t('Status')
          %input(type="text" disabled="disabled" value="#{$statuses[$status]}")

      %fieldset
        %input(type="hidden" name="search" value="#{$search}")
        %input(type="hidden" name="timeRange" value="#{$timeRange}")
        %input(type="hidden" name="status" value="#{$status}")
        %input(type="hidden" name="plateListId" value="#{$plateListId}")
        %input(type="hidden" name="newStartDate" value="#{$startDateEx}")
        -if(!isempty($returnUrl))
          %input(type="hidden" name="returnUrl" value="#{$returnUrl}")          

        %h5=t('Renewal size')
        != CHtml::radioButton('renew_type', $request->renew_type == 'from_duration', array('value'=>'from_duration'));
        != CHtml::dropDownList('renew_pick', 1, $renew_options, array('class'=>'span2'));

        %h5=t('Renewal end date')
        != CHtml::radioButton('renew_type', $request->renew_type == 'from_date', array('value'=>'from_date'));
        .input-prepend.input-append
          !=CHtml::textField('renew_date', $newEndDate, array('class'=>'date-picker span2',"readonly"=>"readonly"))
          .add-on.icon-calendar
        .input-prepend.input-append.time-picker
          %span.add-on
          !=CHtml::textField('renew_time', $newEndTime, array('class'=>'span1',"readonly"=>"readonly","data-format"=>Yii::app()->params['timeselect_format'][Yii::app()->language]['view']))
          %span.add-on
            .icon-time
            
        %button#search-for-alert.pull-right.btn(type="submit")
          = t("Renew")
  
      - $this->endWidget()
      
      %a(href="#{$returnUrl}")
        =t('Go back')
  